#!/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 恢复系统目录
本文出自 “Shell” 博客,请务必保留此出处http://zhizhimao.blog.51cto.com/3379994/1931638
原文地址:http://zhizhimao.blog.51cto.com/3379994/1931638