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

Geoffrey Myers lists at serioustechnology.com
Sat Aug 27 12:51:29 EDT 2011


David Tomaschik wrote:
> 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.)

Good point. ;)

> 


-- 
Until later, Geoffrey

"I predict future happiness for America if they can prevent
the government from wasting the labors of the people under
the pretense of taking care of them."
- Thomas Jefferson


More information about the Ale mailing list