Today, I am giving you a little something that I have been working on for a bit now :) It is quite extensive, supporting incremental and full backups, as well as creating a copy to a remote FTP and the with the wrapper script, you will find that I e-mail the results from the backup operation to myself or anyone else that needs to receive the log Well, here is the main script, used to create the mysql dumps of the different servers and their respective DB's
#!/bin/bash # MySQL Daily Backup Script # Ver.2.1 # Author : JA Clarke, 2009/01/10 # Last Modified : 2009/11/26 # ClientModRef : TrafficSynergy_DailyBackups_MySQL_009 # =========================================================== # This script uses a array link-list of mysql server hosts, # db's, username, password and port to create a GZip # compressed version which is either a incremental backup # or full backup according to the day specifications. # # NOTES: # - Full-backups have been scheduled for Friday's # =========================================================== ### GENERAL CONFIGS ### NOW=$(date +"%d-%m-%y") DAY=$(date +"%a") FULLBACKUP="Fri" ### CHECK IF FULL OR INCREMENTAL BACKUP ### if [ $DAY == $FULLBACKUP ]; then BAK="/usr/home/morpheus/mysql_backups/full_backups/$NOW" else BAK="/usr/home/morpheus/mysql_backups/incremental_backups/$NOW" fi ### MySQL Server Login Info ### MUSER=( [0]="root" [1]="root" ) MPASS=( [0]="root" [1]="root" ) MHOST=( [0]="localhost" [1]="my_test_sql" ) MPORT=( [0]="3307" [1]="3306" ) ### BACKUP CONFIGS ### INC_FILE="/usr/home/morpheus/mysql_backups/incremental_backups/tar_inc_backup.${NOW}" ### COMMANDS USED ### MYSQL="$(which mysql)" MYSQLDUMP="$(which mysqldump)" GZIP="$(which gzip)" MYSQLADMIN="$(which mysqladmin)" ### FTP SERVER Login info ### FTPU="ftp_user" FTPP="ftp_password" FTPS="ftp_site" FTPD="/private/Backup/" ### FUNCTIONS ### make_incremental_backup() { DB_USER=$1 DB [...]
Later! [url="http://www.john-clarke.co.za"]John Clarke[url]
This entry was posted
on Thursday, November 26, 2009
at 11:44 PM
. You can follow any responses to this entry through the
comments feed
.