标签:exec database ror rms erro 定时备份 local color div
cd usr
mkdir dabackup
vim backup.sh
echo "-----------------------------" >> /usr/dbbackup/dbbackup.log echo `date +%Y%m%d`"erms Database backup start" >> /usr/dbbackup/dbbackup.log /usr/local/mysql/bin/msyqldump -uroot -ppwd erms >>/usr/dbbackup/backup_`date +%Y%m%d`.sql if [ $? -eq 0 ];then if [ -f "/usr/dabackup/backup_`date +%Y%m%d`.sql" ];then
tar -czf /usr/dabackup/backup_`date +%Y%m%d` echo `date +%Y%m%d`"erms Database backup success" >> /usr/dbbackup/dbbackup.log else echo `date +%Y%m%d`"erms Database backup fail!" >> /usr/dbbackup/dbbackup.log fi else echo `date +%Y%m%d`"erms Database backup error" >> /usr/dbbackup/dbbackup.log fi echo "-----------------------------" >> /usr/dbbackup/dbbackup.log find /usr/dbbackup/ -mtime +7 -name backup_\* -exec rm -rf {} \;
更改backup.sh文件权限 chmod 755 /usr/dabackup/backup.sh
每天凌晨3点半备份一次
crontab -e
30 3 * * * /usr/dbbackup/backup.sh
标签:exec database ror rms erro 定时备份 local color div
原文地址:http://www.cnblogs.com/freelyflying/p/6700532.html