Limit Crontab between a specific interval

I have a ruby ​​file, and I need to run it every 3 hours. This code works fine:

27 */3 * * * /path/to/ruby -rubygems /path/to/ruby_file.rb

And I do not want this file to work between midnight 12:00 a.m. to 8:00 a.m.

How to install it?

+3
source share
4 answers

27 9-23/3 * * * should work on most modern Unix variants.

+11
source
27 9-23/3 * * * /path/to/ruby -rubygems /path/to/ruby_file.rb

gotta do the trick.

A good summary of everything can be found in this wikipedia article .

+1
source
*/15    10-20   *       *       *       /usr/bin/php /tmp/myscript.php

*/6     6-9,21-23,0-2   *       *       *       /usr/bin/php /tmp/myscript.php

cron , . : cron 23-0

+1

2-10/4, 2,8 2,6,10?

,

0

All Articles