注:推送的对方服务器,需要配置rsync
#!/bin/bash
#备份etc配置文件
#备份文件放到/backup一份删除3天前的,增量给备份服务器一份
find /backup/* -mtime +3 | xargs rm -rf
mkdir -p /backup_conf/`hostname`_`hostname -I | awk '{print $1}'`_`date +%F`/
tar zcf /backup_conf/`hostname`_`hostname -I | awk '{print $1}'`_`date +%F`/`hostname`_`hostname -I | awk '{print $1}'`_`date +%F`.tar.gz /etc/*
rsync -av /backup_conf/* rsync_backup@172.16.1.41::backup_conf --password-file=/etc/rsync.password