#!/bin/bash IP=`ifconfig ens33|awk -F " " 'NR==2{print $2}'` Path=/backup/${IP} [ ! -d ${Path} ] && mkdir ${Path} -p #bak cd / && tar zcvf ${Path}/conf_$(date +%F).tar.gz etc/rc.d/rc.local var/spool/cron/root server/scripts/ find ${Path}/ -type f -name "*.tar.gz"|xargs md5sum > ${Path}/flag_$(date +%F) # bak to rsync server #rsync -az /backup/ backup@10.10.10.41::backup --password-file=/etc/rsync.passwd #del before 7 day ago find ${Path}/ -type f -name "*.tar.gz" -mtime +7|xargs rm -f