Cron is one of the most useful elements of any *nix based system. Giving you an easy interface to run any command on a periodic basis with a down to the minute granularity. As a systems administrator or systems user you will find yourself using cron to schedule tasks on a regular basis. But to get the best granularity you may need to use the full list of available time string modifiers. This will ensure your process only runs when you absolutely need it to.
The Cron Time String Format
Cron Time String Modifier List
Here is a full list of the available modifiers for your Cron Time String
|*||Matches All Values|
|–||Specify a range of values|
|,||Specify a list of values|
|/||Skip a given number of values|
Cron Scheduling Examples With Modifiers
You can use modifiers to match some pretty specific time intervals for scheduling your process. If you wanted to run a process at noon on the first day of every 3rd month you would write your cron time string like this.
0 12 1 */3 *
Or another example for a process that you want to run every 15 minutes from 2-5AM every Monday, Wednesday and Friday you would format your cron string like this.
*/15 2-5 * * 1,3,5
So now you know how to format your cron time string so that you can easily set your process to happen whenever you need it to run.
For more details on this topic visit this post on Formatting your Cron String or for help setting up your cron time string you can use the Crontab Guru’s interactive interface to create your time string.
And if you like this post check out one of our other posts on how to Speed Up Gzip Compression