Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set cron to run certain commands every one and a half hours?

Tags:

cron

How can I set cron to run certain commands every one and a half hours?

like image 352
Nick Long Avatar asked Oct 29 '08 17:10

Nick Long


People also ask

How do I schedule a cron job every 12 hours?

Show activity on this post. ->cron('0 */12 * * *'); This cron will run the scheduler at every 12 hours.

How do I schedule a script in crontab to run every 5 minutes?

basic 3. /usr/bin/vim. 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.


1 Answers

That's not possible with a single expression in normal cron.

The best you could do without modifying the code is:

0 0,3,6,9,12,15,18,21 * * *  [cmd] 30 1,4,7,10,13,16,19,22 * * * [cmd] 

These might be compressible, depending on the version of cron you have to:

0 */3 * * * [cmd] 30 1-23/3 * * * [cmd] 
like image 161
Alnitak Avatar answered Sep 27 '22 16:09

Alnitak