[ale] cron entry that runs the 2nd saturday of every month

David Tomaschik david at systemoverlord.com
Fri Aug 26 19:33:08 EDT 2011


On 08/26/2011 03:38 PM, Geoffrey Myers wrote:
> Lightner, Jeff wrote:
>> When I had to do this back in 2008 on HP-UX I worked out a script
>> that relied on the cal (calendar) command.
>>
>> The following command line will give you the 2nd Saturday of the
>> month:
>>
>> cal |cut -c19-20 |grep '[0-9]'|head -2 |tail -1
>>
>> The following command will give you today's day of month: date +%d
> Doing something similar only relying on date alone:
>
> date +%d
> date +%u

If you have cron run every Saturday, the %u is unnecessary.  (You know
it's Saturday.)  Then just compare to the range [8-14].  No cal needed. 
(Might be what you're doing already.)

-- 

David Tomaschik, RHCE, LPIC-1
System Administrator/Open Source Advocate
OpenPGP: 0x5DEA789B
http://systemoverlord.com
david at systemoverlord.com



More information about the Ale mailing list