On 18/09/2014 17:44, Joseph wrote:
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 place a script in /etc/cron.monthly. The run-crons script is scheduled to execute every 10 minutes, and it will ensure that your script is executed on a monthly schedule. This is true of both cronie and vixie-cron.

--Kerin

Reply via email to