标签:执行 ubunt 执行文件 date passwd time back lamp mysqldump
DB_NAME=""
DB_USER=""
DB_PASSWD=""
BIN_DIR="/opt/lampp/bin/" # mysql 执行文件目录
TEMP_DIR="/opt/lampp/db_backup/${DB_NAME}/"
BACKUP_DIR="/opt/lampp/db_backup/${DB_NAME}_db_backup/"
DATE=date +%Y%m%d_%H%M%S
rm -rf ${TEMP_DIR}
[ -d ${TEMP_DIR} ] || mkdir ${TEMP_DIR}
[ -d ${BACKUP_DIR} ] || mkdir ${BACKUP_DIR}
find ${BACKUP_DIR} -mtime +10 -exec rm -rf {} ;
${BIN_DIR}mysqldump -u${DB_USER} -p${DB_PASSWD} ${DB_NAME} --lock-all-tables > ${TEMP_DIR}db_backup_${DB_NAME}${DATE}.sql
cp ${TEMP_DIR}db_backup${DB_NAME}${DATE}.sql ${BACKUP_DIR}db_backup${DB_NAME}_${DATE}.sql
标签:执行 ubunt 执行文件 date passwd time back lamp mysqldump
原文地址:https://www.cnblogs.com/itzlg/p/11047834.html