1.打包到本地
2.推送到备份服务器
3.删除若干天前的备份
ip=`awk '/IPADDR/' /etc/sysconfig/network-scripts/ifcfg-eth0 |awk -F "=" '{print $2}' ` cd /data0 && tar zcf /server/backup/$ip_www_$(date +%F).tar.gz ./www rsync -azP /server/backup/ rsync_backup@192.168.1.30::backup/ --password-file=/etc/rsync.password find /server/backup -name “*.tar.gz” -mtime +7| xargs rm -f
再加入mysql备份脚本
mysqldump -uroot -pKangjie_123 -B -A --events | gzip >/server/backup/b.sql.gz
设置定时任务
00 00 * * * /bin/sh /server/scripts/bak.sh > /dev/null 2>&1