# set to 'y' if you'd like to be emailed the backup (requires mutt) MAIL=y
# email addresses to send backups to, separated by a space 使用空格隔開 EMAILS="address1@provider.com address2@provider.com address3@provider.com address4@provider.com"
# set "FTP=y" if you want to enable FTP backups FTP=y
# FTP server settings; group each remote server using arrays # you can have unlimited remote FTP servers FTPHOST="server1" FTPUSER="user1" FTPPASS="password1"
# directory to backup to; if it doesn't exist, file will be uploaded to # first logged-in directory; the array indices correspond to the FTP info above FTPDIR="backups" FTPDIR="backups"
# if you have the mail program 'mutt' installed on # your server, this script will have mutt attach the backup # and send it to the email addresses in $EMAILS
if [ $MAIL = "y" ]; then
BODY="Your backup is ready! Find more useful scripts and info at http://www.ameir.net"
ATTACH=`for file in $BACKDIR/*$DATE-mysqlbackup.sql.gz; do echo -n "-a ${file} "; done`
echo "$BODY" | mutt -s "$SUBJECT" $EMAILS $ATTACH
if [[ $? -ne 0 ]]; then
echo -e "ERROR: Your backup could not be emailed to you! \n";