Run a cron command every 15 minutesPosted Oct. 30, 2008 in Linux/Unix/BSD
Cron is a time based scheduling service on Linux and Unix computers which allows you to run process at specific times for example once a day, once every hour and so on. This brief post looks at how to run a cron command every 15 minutes.
The crontab format is minute - hour - day of month - month - day of week followed by the command to run. In the examples below the command to run is listed as /path/to/command - substitute this with the actual command you want to run. Any of these minute/hour/etc values can be * which matches any value.
There are two ways to run a cron command every 15 minutes. The first is like this, where each minute is specified:
0,15,30,45 * * * * /path/to/command
The above command will run every hour of every day on the hour, and at 15, 30 and 45 minutes past the hour. If you wanted to offset your 15 minute command to run on e.g. the 5th, 20th, 35th and 50th minutes of the hour you could do this instead:
5,20,35,50 * * * * /path/to/command
If you are happy with the command running at 0, 15, 30 and 45 then you can simplify the syntax with the second way of running a cron process every 15 minutes like so:
*/15 * * * * /path/to/command
This last example is the exact equivilent of the first example but more succinct.