$cfg_backup_name = "host1"; $cfg_cache_dir= "/usr/local/fsbackup/cache"; $prog_md5sum = "md5sum -b"; $prog_tar = "/usr/bin/tar"; $prog_ssh = "/usr/bin/ssh"; $prog_rm = "/bin/rm"; $prog_gzip = "/usr/bin/gzip"; $prog_pgp = ""; $cfg_checksum = "timesize"; $cfg_backup_style = "sync"; # backup-a , $cfg_save_old_backup = 1; $cfg_type = "local"; $cfg_local_path = "/home/back/backup_data"; # . $cfg_time_limit = 0; $cfg_size_limit = 0; $cfg_maximum_archive_size = 0; $cfg_root_path = "/"; $cfg_verbose = 2; $cfg_stopdir_prune=0; 1; __DATA__ # /usr/local/etc /etc !/usr/local/etc/share # f!\.core$ f!^core$ f!\.o$ f!\.log$
#!/bin/sh HASH=`find /usr/home/back/backup_data -name *hash -mtime -1`
# if [ -n "${HASH}" ]; then ( tar -cf /usr/home/back/backup_tar/arcamart.tar /usr/home/back/backup_data ) else printf "===>>> not new backup\t" > backup_err.log | err_msg fi exit 0
#!/bin/sh s_copy="/usr/local/bin/rsync -azv -e \"ssh -l back -o StrictHostKeyChecking=no\"" DST="/usr/local/home/back/backup_data" # dir_1="/usr/home/back" # dir_2="/usr/local/home/back" # dir_3="/usr/home/back/backup_tar" # HOME_DIR="/usr/local/home" # # if [ -f ${dir_2}/if_routers ]; then . ${dir_2}/if_routers else echo "Procedure ${dir_1}/if_routers is not install" > ${dir_2}/backup.log 2>&1 exit 1 fi TIMESTAMP=`date +"%Y-%m-%d %R"` # ping get_alive () { check_host="/usr/local/sbin/fping -a" eval ${check_host} $1 > /dev/null 2>&1 } err_msg () { printf "DATE: $TIMESTAMP.\n" >> ${dir_2}/backup_err.log } # , , , , , . get_alive $TEST if [ $? -eq 0 ]; then BACKTEST=`ssh -i /usr/local/home/back/.ssh/id_dsa back@192.168.0.1 "find /usr/home/back/backup_tar -name *.tar -mtime -1 | sed -E 's/.*\///g'"` if [ -n "${BACKTEST}" ]; then (printf "===>>> Start remote backup: ${TIMESTAMP}\n" printf " \n" printf "===================================\n" printf "$ts ===>>>${dir_1}\n" printf "\n" eval ${s_copy} back@${TEST}:${dir_3}/${BACKTEST} ${DST} ) > ${dir_2}/backup.log 2>&1 else printf "===>>> Host: $test is not new backup\t" > ${dir_2}/backup_err.log fi else printf "===>>> Host: $test is down\t" > ${dir_2}/backup_err.log | err_msg exit 1 fi # , get_alive $ exit 0
Source: https://habr.com/ru/post/133051/
All Articles