On Tue, Jun 27, 2006 at 08:19:41AM -0300, Daniel da Veiga wrote: > On 6/27/06, Andreas Widerøe Andersen <[EMAIL PROTECTED]> wrote: > >Hi, > >I have a few FreeBSD servers running various web/database things and I'm > >looking for a good a reliable backup script that I can run through a > >cronjob. I'm currently running the latest version of mysql323, but will > >upgrade to version 4.1 soon aswell as upgrade most of the servers to the > >latest FreeBSD version. > > > >Any good suggestions to a script that will back up my databases and make > >things ready for an easy restore if I need to? > > > > 30 23 * * * date=`date -I` && /usr/bin/mysqldump --opt -B -C -h<host> > -<user> -p<password> <database> | bzip2 -c > > path/to/backup/$date-<database>.sql.bz2 > > I guess it will work on a FreeBSD, its my own cron job here...
I would also suggest removing old archive copies: MYSQL="`which mysql 2>/dev/null`" || MYSQL="/usr/local/bin/mysql" MYSQL_ARGS="--opt -h localhost -uuser -ppass db" ARCHDIR=/usr/local/db/blah NAME=db_dump # Remove archives older than 64 days find ${ARCHDIR} -type f -mtime +64 | xargs rm -f # Create new archives cd ${ARCHDIR} && mysqldump ${MYSQL} ${MYSQL_ARGS} > ${NAME}.`date +%Y%m%d` Cheers, -- Timur Izhbulatov OILspace, 26 Leninskaya sloboda, bld. 2, 2nd floor, 115280 Moscow, Russia P:+7 495 105 7245 + ext.205 F:+7 495 105 7246 E:[EMAIL PROTECTED] Building Successful Supply Chains - One Solution At A Time. www.oilspace.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]