Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a cronjob which runs every 5 minutes all the day in a week. I want to stop this cronjob for 2 hrs only on Sunday. Could you pls help me to set this.

share|improve this question
Also asked over at superusers, answers given there as well… – Viper_Sb Jul 7 '11 at 14:36

Rather than mess with esoteric crontab schedule entries, have your script check for a file and to not do a full run if the file is present. Then, schedule a second script in cron to create that file on Sunday at the time you want the other script to stop, and then another script 2 hours later in cron to remove the file.

That way, you can be flexible about when the main script does and doesn't run by just changing the times of the create/remove scripts.

share|improve this answer
In addition to simplicity, this approach also provides a way for you to easily and temporarily "pause" your script if you are doing some other work that might interfere, via a simple command like "touch /etc/myscript/pause", or whatever your "pause file" is called. Then "unpause" with "rm /etc/myscript/pause". – Ryan Fisher Jul 7 '11 at 17:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.