On 19-Feb-2003 Jeff Mao wrote:
> Greetings all,
>
> Not sure if this is the right place to ask this,...I use the
> following script on an OS X server to backup my mysql databases:
>
> #!/bin/sh
> DATE=`/bin/date +%Y%m%d"_"%H%M%S`;
> cd /Users/usernmae/Documents;
> /usr/bin/mysqldump -hhost -uusername -ppassword --all-databases >
> full_dump_$DATE.sql;
> exit
>
> The script runs on from the crontab each morning at 3:30 am. Simple
> question, I got the script from someone else, so I'm not too savvy
> with scripting. What can I add to the script so that it
> automatically erases backups that are x weeks or days old? If I
> forget about it, the backup folder soon blossoms as it collects a new
> backup each day, and I'd like to automate the process more so I'm not
> holding on to tons of old backups.
>
find /Users/usernmae/Documents -mtime +7 -name "full_dump*.sql" -exec rm{} \;
will delete backups older than a week (7 days)
Regards,
--
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.
(53kr33t w0rdz: sql table query)
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php