LAMP集群项目五 项目备份

时间:2023-12-26 17:58:49

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 +| 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