How could i tell crontab to run every 5 minutes, but starting at the second minute of the hour. In other words, i would like to execute my script when minute % 5 = 2
.
For example, my script should run at :
08:02 08:07 08:12 08:17 ...
Thanks for your help!
tiny 4. /bin/ed Choose 1-4 [1]: Make a new line at the bottom of this file and insert the following code. Of course, replace our example script with the command or script you wish to execute, but keep the */5 * * * * part as that is what tells cron to execute our job every 5 minutes. Exit this file and save changes.
0 * * * * Execute a cron job every hour. 0 12 * * * Fire at 12:00 PM (noon) every day.
In a cron we can not schedule a job in seconds interval. i.e You cannot schedule a cron job to run every 5 seconds.
How does it work? The asterisk (*) operator specifies all possible values for a field. For example, an asterisk in the hour time field would be equivalent to every hour or an asterisk in the month field would be equivalent to every month. An asterisk in the every field means run given command/script every minute.
There are two possibilities:
2,7,12,17... command */5 .... sleep 120 ; command
crontab
sleep
command before the actual command If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With