#!/bin/bash
src=/server/system_backup/
dst=/
backup () {
rsync -av --exclude={"/proc","/sys","/run","/server"} $dst $src
}
recovery () {
rsync -av --delete --exclude={"/proc","/sys","/run","/server"} $src $dst
}
case $1 in
backup)
backup
;;
recovery)
recovery
;;
*)
echo "Usage: {backup|recovery}"
esac
~
运行 tools.sh backup 备份系统目录
tools.sh recovery 恢复系统目录
转载于:https://blog.51cto.com/zhizhimao/1931638