Implementation features: The Daily data (/www,/log) of client Server A is packaged locally, and the scheduled script is synchronized to the server on the server every day, and the backed up data is verified on the servers, and the results are sent to the administrator's mailbox. Client:
#!/bin/bashremote_host=172.16.1.111 remote_path=/backup local_backup_path=/backuplocal_file_path=/data [-D $local _backup_path]| | Mkdir-p $local _backup_path #打包 cd ${local_file_path}&& tar zcf $local _backup_path/www-$ (date +%f). tar.gz/data/ www && tar zcf $local _backup_path/log-$ (date +%f). Tar.gz/data/log && find/backup-type f-name "*.tar.gz "| Xargs md5sum > $local _backup_path/flag_$ (Date +%f) #同步rsync-avz $local _backup_path/* $remote _host:$ Remote_path--PASSWOD (omitted) #删除本地七天前find $local _backup_path-type f-name "*.tar.gz"-mtime +7| Xargs rm-f
Join a timed task
crontab-e04*** /bin/bash/root/shell/www_backup.sh &>/dev/null
Service side:
#!/bin/bashlocal_backup_path=/backupmd5_file=flag_$ (date +%f) CD $local _backup_path if[$?-eq 0];then if[-e $md 5_ File];then md5sum-c ${md5_file}>> mail.txt if[$?-eq 0];then mail-s "Success! The backup task is OK! " [Email protected] < Mail.txt else mail-s "Failed! The backup task is failed! " [Email protected] < Mail.txt fi else ls > mail.txt mail-s "Failed! The md5_file is not exists! " [Email protected] < Mail.txt fi
Join a timed task
crontab-e05*** /bin/bash/root/shell/flag_check.sh &>/dev/null
From for notes (Wiz)
Offsite Backup Synchronization Check Script