Cron jobs and holidays

John Macdonald john-Z7w/En0MP3xWk0Htik3J/w at public.gmane.org
Fri Dec 15 15:36:36 UTC 2006


On Thu, Dec 14, 2006 at 01:53:57PM -0500, Neil Watson wrote:
> How would you ensure that a cron job was not run on a statutory holiday?
> My current thought was
> 
> 4 4 * * 2-6 grep `date +%Y%m%d` /etc/holidays 1>/dev/null && my_script
> 
> Using this method the holidays file is kept manually.  Is there a more
> elegant and automatic way?

The one item of elegance I'd add is to put the test into
a script so that it can be used in other cron lines (and
elsewhere too).

4 4 * * 2-6 today_is_holiday && my_holiday_script
4 4 * * 2-6 today_is_holiday || my_normal_script

-- 
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list