[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cron bash date



* Lance Hoffmeyer (lance@augustmail.com) [030731 21:46]:
> Hello,
> 
> I am trying to run a bash script in cron.  I originally wanted
> it to run at 11:59pm on the last day of every month.  February
> will always cause problems because of leap years.  Therefore,
> I decided to run cron on the first day of every month using
> the @month parameter.
> 
> The problem is that I want the month to reflect the previous month.
> 
> MON=$((`date +%m`-1))

Touch a file every day, say at 00:05.  Then in your script that runs on
the first of the month (say at 00:03), use date -r $FILE.  You'll get
yesterday's date.

good times,
Vineet
-- 
http://www.doorstop.net/
-- 
"Computer Science is no more about computers
than astronomy is about telescopes."  -- E.W. Dijkstra

Attachment: signature.asc
Description: Digital signature


Reply to: