[sclug] cron expression

Ed Davies sclug at edavies.nildram.co.uk
Tue Jan 23 18:03:16 UTC 2007


Jonathan H N Chin wrote:
 > If you have GNU date on your path:
 >
 > 	MM HH * * * [ `date -d+2day +%d` = 1 ] && MYSCRIPT

Thanks - I've learnt something new about date which could come
in handy as I will soon be needing a script which knows the
previous day's date.

However, I needed:

[ `date -d+9day +%d` = 01 ] && echo boo

with a leading zero on the number to get it to say "boo".

 > Fill in MM, HH and MYSCRIPT as appropriate.
 >
 > You could give DoM as "28,29,30,31" but it hardly seems worth it.

27,28,29,30 surely?

Ed.


More information about the Sclug mailing list