Cron x/y pattern not working as espected
See original GitHub issueHi,
I noticed that pattern x/y, as every y starting from x is not wotking
According to crontab.guru this pattern should produce:
“At every 2nd minute from 0 through 59.”
But in the attached code i’ve noticed a different behavior (applied to seconds for brevity). It triggers just at the very start of every minute insted of every 2 seconds starting from second 0
var event = schedule.scheduleJob("0/2 * * * * *", function() { var dt = dateTime.create(); console.log("Inserting new data: " + dt.format('Y-m-d H:M:S')); });
Output:
Inserting new data: 2017-09-13 16:35:00 Inserting new data: 2017-09-13 16:36:00 Inserting new data: 2017-09-13 16:37:00 Inserting new data: 2017-09-13 16:38:00
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Cron job not working as expected configured with Quartz ...
First scheduler which runs every 5 minute forever works well without any problem. Second scheduler expression ( 0 30/5 9-14 ? * MON,TUE,WED,THU, ......
Read more >How To Use Cron to Automate Tasks on Ubuntu 18.04
Cron is a time-based job scheduling daemon found in Unix-like operating systems, including Linux distributions. This guide provides an ...
Read more >Cron job troubleshooting guide - Cronitor
This guide will walk you through locating cron jobs on your server, validating their schedules, and debugging common problems.
Read more >Why is my crontab not working, and how can I troubleshoot it?
The vast majority of "my cron script doesn't work" problems are caused by this restrictive path. If your command is in a different...
Read more >Kubernetes CronJobs at Scale Part 1 by Kevin Yang
In our old environment, the machine running that cron is sitting idle 99.85% of the time. With Kubernetes CronJob, compute resources (CPU, ...
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
@fabiomor I’ve been looking into this and TBH after reading the crontab manual I’m not sure that format is correct:
I’m not completely sure that using a value with step values is a valid crontab expression. It seems that only ranges and * are valid. /cc @harrisiirak what do you think?
Anyway, for your use case you could always use
0-59/2 * * * * *
and it should work.Closing then. Thanks!