3

I want to run a job using crontab every other Monday. Is it possible?

3 Answers 3

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.

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.

0

Might as well use (Roaring Penguin's) remind if you are going to use more than just a crontab entry.

You must log in to answer this question.