I want to run a job using crontab every other Monday. Is it possible?
Asked
Active
Viewed 1,845 times
3 Answers
1
Put '1/2' in the day of the week field. This will work with VixieCron and Anacron, but it won't work with the older versions of cron.
Paul Tomblin
- 2,102
- 4
- 21
- 25
1
No experience here with VixieCron or Anacron; if you're using one of them, try Paul Tomblin's answer. If you're not, you could set up a shell script something like the following:
FLAG_FILE="alternate_monday_flag_file"
if [ -e $FLAG_FILE ]
then
# Replace this comment with a call to the script you really want to run
chmod u+w $FLAG_FILE
rm $FLAG_FILE
else
touch $FLAG_FILE
chmod u-w $FLAG_FILE
fi
Just make sure this is the only job that will do anything with the alternate_monday_flag_file. The chmod u+w before the rm and chmod u-w after the touch are there to help ensure that.
GreenMatt
- 855
- 3
- 14
- 27
0
Might as well use (Roaring Penguin's) remind if you are going to use more than just a crontab entry.
MarceloR
- 56
- 1