Tuesday, July 31, 2007

Need to schedule a job for the last day of the month?

Lets say you need to run a command on the last day of the month. The corn system needs you to provide the day of the month ( like 28,29,30,31) . Since the last day of the month is not a fixed date, cron comes short on this requirement.

Fortunately, these is a easy way to work around this. Shell to the rescue :

00 09 * * * [ `date -d tomorrow +'%d'` = '01' ]&&/command/to/run

No comments:

About Me

California, United States