tags:

views:

1536

answers:

3

I would like to run a job through cron that will be executed every second Tuesday at given time of day. For every Tuesday is easy:

0 6 * * Tue

But how to make it on "every second Tuesday" (or if you prefer - every second week)? I would not like to implement any logic in the script it self, but keep the definition only in cron.

+4  A: 

Try this link

DilbertDave
basically the same as xahtep's answer but with a nice graphic detailing what the parms represent ;-_
DilbertDave
+10  A: 

How about this, it does keep it in the crontab even if it isn't exactly defined in the first five fields:

0 6 * * Tue expr `date +\%W` \% 2 > /dev/null || /scripts/fortnightly.sh

(from http://insignificant.org/2008/03/16/fornightly-cron-jobs/)

xahtep
+2  A: 

Multiple lines in the crontab. See This question for an example of a similar problem.

ConcernedOfTunbridgeWells