The current backup dumps it into one large file Here is the current backup: #!/bin/sh
cd /Volumes/local_backup/ date=`date +%y%m%d_%H%M%S` file_name="dump_$date.sql" gzip_name="$file_name.gz" prev_name="dump.sql.gz" backup_path="/Volumes/backup/mysql-dumps/$gzip_name" echo "Daily Backup $date" echo "Dumping data..." mysqldump --host=192.168.169.4 --user=!!!!!!!! --password=!!!!!!! --result-file=$file_name --single-transaction --flush-logs --master-data=2 --all-databases gzip -v $file_name chmod 640 $gzip_name echo "Copying file..." cp -v $gzip_name $backup_path rm -f $prev_name mv $gzip_name $prev_name mysql --host=192.168.169.4 --user=!!!!! --password=!!!!!!! -e "SHOW SLAVE STATUS\G" | egrep 'Last_|Slave_' echo "Daily backup of xserve2 database complete. Check this for errors." I want to adapt this to do all the databases separately. Thanks Dave On Mon, Jul 7, 2014 at 10:54 AM, Paul Flint <[email protected]> wrote: > Dear David, > > To the extent that you feel comfortable, can you send out copies of the > backup scripts? > > Regards, > > Paul > On Mon, 7 Jul 2014, Tisdell, Dave wrote: > > Date: Mon, 7 Jul 2014 10:52:26 -0400 >> From: "Tisdell, Dave" <[email protected]> >> Reply-To: Vermont Area Group of Unix Enthusiasts <[email protected]> >> To: [email protected] >> Subject: scripting mysql database backups >> >> Hi all, >> >> I have several mysql databases that I want to run separate backups of >> rather than doing an entire database dump into 1 file. >> The idea is that each database backup would go into its own directory at >> the end of the backup path i.e. >> /dbbackups/database1/db-back1 >> /dbbackups/database 2/db-back2 >> etc >> What I have done so far is use the sql "SHOW DATABASES" command to >> redirect >> to a dblist text file. What I would like the script to do is go through >> the >> file and backup every database in the list. I am already using sed to >> remove the word database that gets generated by the show command and any >> databases I don't want backed up from the list so that the result is a >> list >> of databases that want backed up. >> Periodically databases get added. The idea is that the backup will >> automatically add the new databases without my editing the script based >> upong the list generated by the "Show Databases" command. >> I am getting to a level of complexity in scripting that I have not done >> before. I want the same set of commands run on every db in the list. >> Thanks. >> >> Dave >> >> -- >> David Tisdell. Music Teacher >> Browns River Middle School >> 20 River Road >> Jericho, VT 05465 >> [email protected] (e-mail) >> >> -- >> >> >> This e-mail may contain information protected under the Family Educational >> Rights and Privacy Act (FERPA). If this e-mail contains student >> information >> and you are not entitled to access such information under FERPA, please >> notify the sender. Federal regulations require that you destroy this >> e-mail >> without reviewing it and you may not forward it to anyone. >> >> > Kindest Regards, > > > > Paul Flint > (802) 479-2360 Home > (802) 595-9365 Cell > > /************************************ > Based upon email reliability concerns, > please send an acknowledgement in response to this note. > > Paul Flint > 17 Averill Street > Barre, VT > 05641 > -- David Tisdell. Music Teacher Browns River Middle School 20 River Road Jericho, VT 05465 [email protected] (e-mail) -- This e-mail may contain information protected under the Family Educational Rights and Privacy Act (FERPA). If this e-mail contains student information and you are not entitled to access such information under FERPA, please notify the sender. Federal regulations require that you destroy this e-mail without reviewing it and you may not forward it to anyone.
