Cron expression to run every N minutes -
i need build cron expression run job every 10 minutes after user click on start button.
i'm trying like:
0 42/10 * * * ? *
and 42/10 user click start @ hh:42 (example: 18h42). next schedule like:
1. friday, march 20, 2015 6:42 pm 2. friday, march 20, 2015 6:52 pm 3. friday, march 20, 2015 7:42 pm 4. friday, march 20, 2015 7:52 pm 5. friday, march 20, 2015 8:42 pm
the problem after second execution, job waits hour perform next execution. how can build cron expression starts , after still running after n minutes?
thank in advance.
i think format wrong. order of fields is:
- minute
- hour
- day of month
- month
- day of week
- command
so in example, minute
0, , hour
invalid (hour
must in range 0-23
). i'm guessing cron ignoring incorrect hour
, , running on minute 0
of every hour.
however, if did want run every n minutes, use format (where n less 60):
0/n * * * * /bin/echo "your command here"
however, keep in mind /n
repeats command every n minutes within current hour. so, if have 0/33
in crontab command run at:
- 00:00
- 00:33
- 01:00
- 01:33
not at:
- 00:00
- 00:33
- 01:06
- 01:39
Comments
Post a Comment