CronJob executing several times
See original GitHub issueI am using cron job to run a task at night only one time but the cron is running multiple times due to which my code gets executed several time. How can I stop this.
`var Job = new CronJob({
cronTime: '* * 01 * * *', //Execute at 1 am every day
onTick : function() {
co(function*() {
yield insertToDatabase(); //this is the function that does insert operation
}).catch(ex => {
console.log('error')
});
},
start : false,
timeZone: 'Asia/Kolkata'
});`
I have placed the job.start() in the index.js file. Can you please help me figure out what I am doing wrong!
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How can I prevent Cronjobs from running multiple times?
It is common to execute cronjobs frequently, for example, every minute. The execution time, in tendency, increases with a growing data set.
Read more >Script was triggered multiple times by cron - Blog
I am using crontab to trigger a PHP-scraping script on regular basis, but the script gets called multiple times. A recherché revealed that...
Read more >Cronjob executing multiple times at once - Server Fault
Anyone know what the problem may be? The python script is simply outputting the current time so we can say for sure that...
Read more >Cron running job multiple times - Ask Ubuntu
I guess you want to change it to a single value between 0..59. For more information do, "man 5 crontab". Share.
Read more >Crons executed multiple times. - The UNIX and Linux Forums
Two cron daemons running? The same jobs in two crontab files? When you say "5.8", I assume you mean Solaris. What does /var/cron/log...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This pattern
'* * 01 * * *'
is saying “at every second from 01:00:00 to 01:59:59 every day”.I think you just need to use
'00'
in place of the minute and second fields: ‘00 00 01 * * *’.I also had the same problem and i notice that server is run on cluster mode. so need to put cronjob in