working on cron-parser for node.js
<p>I need help on using cron-parser for node.js
I don't quite understand how the job will run then log the result of the cron job.</p>

<p>Based on the examples given here <a href="https://github.com/harrisiirak/cron-parser" rel="nofollow">https://github.com/harrisiirak/cron-parser</a>
it's iterating the time/interval of the expression instead of the normal cron job that will only show result/s of job when the actual cron job finished.</p>

<p>Questions are, how do I create a normal cron job that will only run, let's say every minute and how could I create multiple jobs that will simultaneously and asynchronously run 3 and 5 minutes respectively.</p>

<p>This is what I did which should run every 5 minutes which unfortunately doesn't print any results every 5 minutes.</p>

<pre><code>try {
        var interval = parser.parseExpression('*/5 * * * *');

        while (true) {
            try {
                var obj = interval.next();

                if (obj.done)
                    console.log("Cron Job: run every 5 minutes.");
            } 
            catch (e) {
                break;
            }
        }
    } 
    catch (err) {
        console.log('cron parser error: ' + err.message);
    }
</code></pre>

<p><strong>EDIT</strong>
So technically, I can't cron-parser to create jobs so instead going with cron module to handle my cron jobs. I got the cron job working also creating multiple jobs. Problem now is whenever I create multiple cron jobs using in array, first job successfully runs, but on the second job, right after it hit the time to run it, it fails and gives me </p>

<pre><code>uncaughtException: timer._repeat is not a function
</code></pre>

<p>This is what I did:</p>

<pre><code>for (var data in lists){
        sampleData.find({ id: lists[data].id }, function(err, samples){
            if (err){
                console.log("Server error");
            }
            else{
                for (var sample in samples){
                    new cron("*/3 * * * *", function() {
                        console.log(sample);
                    }, null, true, null);
                }
            }
        });
    }
</code></pre>