[WBEL-users] quick script help
John Morris
jmorris at beau.org
Thu Mar 31 16:28:48 CST 2005
On Thu, 2005-03-31 at 11:22, Erick Perez wrote:
> i want to run a cron at certain time in the morning and that cron should:
> 1- check for file named /var/log/mondo-archive.log
> 2- if exists move the file to /root/backuplogs/mondo-archive.log.TODAYSDATE
Sure you aren't reinventing the wheel? Can logrotate do what you need?
> how do i extract todays date(format MMDDYY), save it into a variable
> and then append it to the filename
Don't have my camel book here but wouldn't $timestamp=`date +%Y%m%d` do
the trick? You do want yyyymmdd so directory listings will sort in date
order right? And lets not go repeating the Y2K mess and keep using two
digit years again, but if you insist just make the Y a small one. :)
--
John M. http://www.beau.org/~jmorris This post is 100% M$Free!
Geekcode 3.1:GCS C+++ UL++++$ P++ L+++ W++ w--- Y++ b++ 5+++ R tv- e* r
More information about the Whitebox-users
mailing list