mysql备份shell脚本

#!/bin/bash
### MySQL Server Login Info ###
MUSER="root"
MPASS="root"
MHOST="localhost"
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
DBNAME="test"
BAK="/backup/mysql"
GZIP="$(which gzip)"
### FTP SERVER Login info ###
FTPU="test"
FTPP="test"
FTPS="192.168.1.1"
NOW=$(date +"%F")


[ ! -d $BAK ] && mkdir -p $BAK


FILE="${BAK}/${DBNAME}-${NOW}.gz"
$MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $DBNAME | $GZIP -9 > $FILE


#lftp -u $FTPU,$FTPP -e "cd /Backup/testlink; mput $FILE; quit" $FTPS


#rm $FILE

你可能感兴趣的:(mysql,Date,server,shell,File,login)