update 20160920
This commit is contained in:
51
cloneBackup_copyBox.sh
Executable file
51
cloneBackup_copyBox.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
MountScript1="$1"
|
||||
UmountScript1="$2"
|
||||
MountScript2="$3"
|
||||
UmountScript2="$4"
|
||||
CloneMntSrc="$5"
|
||||
CloneMntDst="$6"
|
||||
|
||||
red=`tput setaf 1`
|
||||
green=`tput setaf 2`
|
||||
yellow=`tput setaf 3`
|
||||
reset=`tput sgr0`
|
||||
|
||||
echo "${green}### start clone backup${reset}"
|
||||
|
||||
CMD=("sudo" "sh" "${MountScript1}")
|
||||
if ! "${CMD[@]}"; then
|
||||
sudo sh "${UmountScript1}"
|
||||
echo "${red}Error(1): execution of mount script ${yellow} ${MountScript1} ${red} failed${reset}"
|
||||
exit 1
|
||||
else
|
||||
echo "${green}Succesfull(1): mount script ${yellow} ${MountScript1} ${green} execution was successfull.${reset}"
|
||||
fi
|
||||
|
||||
CMD=("sudo" "sh" "${MountScript2}")
|
||||
if ! "${CMD[@]}"; then
|
||||
sudo sh "${UmountScript1}"
|
||||
sudo sh "${UmountScript2}"
|
||||
echo "${red}Error(1): execution of mount script ${yellow} ${MountScript2} ${red} failed${reset}"
|
||||
exit 1
|
||||
else
|
||||
echo "${green}Succesfull(1): mount script ${yellow} ${MountScript2} ${green} execution was successfull.${reset}"
|
||||
fi
|
||||
|
||||
echo "${green}--- start rsync-clonebackup from ${yellow}${CloneMntSrc}${green} to ${yellow}${CloneMntDst}${reset}"
|
||||
CMD=("sudo" "rsync" "-PWavxh" "--delete" "--progress" "-e" "ssh" "${CloneMntSrc}" "${CloneMntDst}")
|
||||
if ! "${CMD[@]}"; then
|
||||
sudo sh "${UmountScript1}"
|
||||
sudo sh "${UmountScript2}"
|
||||
echo "${red}Error(4): rsync-clonebackup aborted${reset}"
|
||||
exit 1
|
||||
else
|
||||
echo "${green}Succesfull(4): rdiff-backup finished${reset}"
|
||||
fi
|
||||
|
||||
echo "${green}### unmount folders${reset}"
|
||||
sudo sh "${UmountScript1}"
|
||||
sudo sh "${UmountScript2}"
|
||||
|
||||
echo "${green}### finished clone backup${reset}"
|
||||
Reference in New Issue
Block a user