AniNIX::Aether \\ Backup and Failsafe System
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

22 lines
781 B

#!/bin/bash
if [ "$(whoami)" != "root" ]; then
echo Needs to be run as root.
exit 1;
fi
if (ping -c 4 "$1" | grep -c ' 0% packet loss,'); then
printf "Are you sure you want to back everything up to %s?\nIs the root password set and all storage mounted?\nDo you have time for this backup to complete?\nEnter YES in all capitals to continue..." "$1"
read answer
if [ "$answer" != "YES" ]; then
echo User did not confirm.
exit 1;
else
rsync -aAXv --delete --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / root@"$1":/mnt/
status="$?"
echo rsync exited with status $status
exit $status
fi
else
echo "Host is not responding in a timely fashion."
exit 1;
fi