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.
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
I know that Sachin already explained, but for who are still lost on this explanation, have a very nice website to explain a cronjob:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.