node.jscronschedulernode-cron

Node-cron on windows server


I have used node-cron to schedule job in my node application and I work on ubuntu OS. Below is the code for same. I am running the scheduler every one hour and it works fine on my local machine.

new CronJob('0 0 * * * *', function() {
    eventController.init()
}, null, true, 'Asia/Kolkata')

When I deploy this code to a windows server (using iis-node) the scheduler runs every one minute. Has anyone encountered the same issue?

Thanks in advance.


Solution

  • Make your cron on following pattern:

    * * */1 * * *
    

    Description: From left:

    Seconds: 0-59
    Minutes: 0-59
    Hours: 0-23
    Day of Month: 1-31
    Months: 0-11
    Day of Week: 0-6