Jeff Mao <[EMAIL PROTECTED]> writes: > 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?
Probalbly lots of ways:) You could use find to l�oace files older than some date, and erase them. Or if one week is god for you you could change your script to do something like this: /usr/bin/mysqldump -hhost -uusername -ppassword --all-databases > `date +%V`/full_dump.sql; That will give you 7 directories, one for each weekday, with a dump each. -sig -- Sigurd Urdahl [EMAIL PROTECTED] Systemkonsulent | Systems consultant www.linpro.no LIN PRO can improve the health of people who consume the eggs, meat and milk [..] (http://www.werneragra.com/linpro.html) --------------------------------------------------------------------- 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
