Restrict Crontab job between a particular interval
I have a ruby file and I need to run it once in every 3 hours. This code works fine:
27 */3 * * * /path/to/ruby -rubygems /path/to/ruby_file.rb
And I don't want this file to开发者_开发知识库 run between midnight 12.00 to morning 8.00
How can I set it?
27 9-23/3 * * *
should work on most modern variants of Unix.
27 9-23/3 * * * /path/to/ruby -rubygems /path/to/ruby_file.rb
should do the trick.
A good summary of it all can be found in this wikipedia article.
*/15 10-20 * * * /usr/bin/php /tmp/myscript.php
*/6 6-9,21-23,0-2 * * * /usr/bin/php /tmp/myscript.php
More complex cron for you my friend. Notice: cron do not jump over 23-0
2-10/4 like 2,8 or 2,6,10 ?
I think the seconds
精彩评论