How to use crontab in specific use cases

Here I will post non standard and ‘out of the ordinary’ crontab settings. A note to myself (ANTM): crontab file in Centos is located in /etc/crontab. Lets start:

Run a cron job every 5 minutes but starting from minute 3.

Surely you can go about this like so:

3,8,13,18,23,28,33,38,43,48,53,58 * * * * /bin/mycommand

but there’s much cleaner way of doing it:

3-59/5 * * * * /bin/mycommand

More info can be found on this Stack Overflow question and also another option is suggested here and goes like this:

*/5+3 * * * * /bin/mycommand

Similarly

Run a cron job every 5 minutes

*/5 * * * * /bin/mycommand

 

Written by Nikola Brežnjak