Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restrict Crontab job between a particular interval

Tags:

crontab

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?

like image 854
Sayuj Avatar asked Dec 10 '22 08:12

Sayuj


1 Answers

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

like image 181
Kris Jenkins Avatar answered Dec 17 '22 22:12

Kris Jenkins