#!/bin/bash

Backup_dir="/backup" IP_info=$(hostname -i | awk -F ' ' '{ print $2 }')

Create Backup Dir

mkdir -p $Backup_dir/$IP_info

Tar backup Data

cd / tar -zchf $Backup_dir/$IP_info/system_backup_$(date +%F_week%u -d -1day).tar.gz ./etc/rc.local

day 7 ago data

find $Backup/$IP_info/ -type f -mtime +7 | xargs rm 2>/dev/null

create finger file

find $Backup_dir/$IP_info -type f ! -name "finger*" | xargs md5sum > $Backup_dir/$IP_info/finger.txt

push Backup_data to Backup_server info

rsync -avz $Backup_dir/ rsync@172.168.0.41::backup --password-file=/etc/rsync.passwd