Go back to the main page

Cron time ranges

 

Let's say you wanted a task to only run every 4 minutes from time ranges of 6PM to 1AM and 3AM to 7AM. Just do the following:

# /etc/crontab
*/4 18-1,3-7 * * * root eval "$lynx/library/mysql.batch.php?runQuery=e > /tmp/www_dir/cp/dims/${c_date}_lumber_archive.html"

Right? Wrong. It is has to be done in 3 parts like so:

*/4 18-23,0-1,3-7 * * * root eval "$lynx/library/mysql.batch.php?runQuery=e > /tmp/www_dir/cp/dims/${c_date}_lumber_archive.html"
  • Pushed on 03/03/2012 by Christian