Am 18.09.2014 um 18:44 schrieb Joseph:
> I want to run a cron job only once a month.  The problem is the computer is 
> only on on weekdays Mon-Fri. 1-5
> cron tab as this below is an "or" condition as it has entries in Days of the 
> Months and Day of the  Week
> 
> 5 18 1 * 2  rsync -av ...
> 
> so it will run on days 1 or Tuesday of each months.
> Is it possible to create "and" condition, eg. run it on Tuesday between days 
> 1 to 7; depend on which day Tuesday falls on?

You can run it every Tuesday and check for day of month externally:

5 18 * * 2   test $(date +%d) -le 7 && rsync -av ...

or run it on

5 18 1-7 * * and test for Tuesdays, but the former gives less useless 
invocations.

 ~frukto 




Reply via email to