标签:time mys shel cal oca trigger shell -- $?
vim db_all.sh
#!/bin/sh
logFile=/home/shell/db_backup.log
DATE=`date +‘%Y%m%d_%H_%M‘`
cd /home/data/backup/fullbak
echo begin bak alldb $DATE >>$LogFile
/usr/local/mysql/bin/mysqldump -udbbak -pdbbak@2020!$% --single-transaction --master-data=2 --all-databases -R -E -e -q --triggers| gzip > bak_pay_slave227-$DATE.sql.gz
resultbak=$?
echo result: $resultbak $DATE end alldb bak >>$LogFile
/bin/find /home/data/backup/fullbak -mtime +2|xargs rm -f
注:记得创建备份用户
标签:time mys shel cal oca trigger shell -- $?
原文地址:https://www.cnblogs.com/zhm1985/p/12717556.html