|
From: Lincoln S. <ls...@cs...> - 2004-03-18 17:53:48
|
Hi Charles, I'm not an expert on mysql administration, but I think that the=20 section called "Database Backups" in the Mysql database=20 administrators handbook will give you all the info you need. Here's one simple recipe: mysqldump --tab=3D/path/to/some/dir --opt db_name Lincoln On Wednesday 17 March 2004 09:30 am, Charles Hauser wrote: > All, > > I'm interested in writing a cron job to backup mysql that will: > - Backup all the global information first (users and groups, > typically) - Backup each database independently (not dumpall) > > for postgres I can do this using: > > - globals > pg_dumpall -U $PG_ADMIN -g > $PG_BACKUP_DIR/globals.sql > > - databases > > for database in $(psql -l -t -d template1 -U $PG_ADMIN | cut -f1 > -d'|') ; do > if [ $database =3D "template0" ] ; then > continue # we cannot backup or restore this database > fi > > # actually dump the database to a pg_dump "custom" file > format... syslog debug "Attempting to backup database $database." > pg_dump -f $PG_BACKUP_DIR/$database.custom -Fc -U $PG_ADMIN > $database > if [ $? !=3D 0 ] ; then > syslog crit "CRITICAL Failed to backup database $database." > else > syslog info "Backed up database $database." > fi > > done > > charles > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO > of GenToo technologies. Learn everything from fundamentals to > system > administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli >ck _______________________________________________ > Gmod-gbrowse mailing list > Gmo...@li... > https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse =2D-=20 Lincoln D. Stein Cold Spring Harbor Laboratory 1 Bungtown Road Cold Spring Harbor, NY 11724 |