[Eug-lug] crontab - last day of month

Rob Hudson rob at euglug.net
Mon Nov 20 12:03:29 PST 2006


Would 1st day of month at midnight be much different than last day of 
month?  If not, that's an easy workaround.

OR

Have 3 crontab entries:

# the months with 30 days
0	0	30	4,6,9,11	*	command
# the months with 31 days
0	0	31	1,3,5,7,8,10,12	*	command
# February is screwy (but you can probably do a /4, /100, /400 thing?)
0	0	28	2	*	command

-Rob

Matthew Jarvis wrote:
> It seems I stepped in some doodoo trying to accomplish this - hard to 
> believe this is so hard...
> 
> How do I tell a cron job to run on the last day of the month?
> 
> i.e. Feb 28 (or 29 whatever), Apr 30, Mar 31....  I'm being so explicit 
> because another group I posted this to just didn't grasp that I wanted 
> the last day, rather than specifically telling it the 28th or something...
> 
> One suggestion was to run it for 28, 29, 30, 31 and then determine some 
> other way if it's really the last day of the month...
> 
> Some say it can't be done... are they right?
> 
> 


More information about the EUGLUG mailing list