Created
August 20, 2014 22:54
-
-
Save rileyrg/92aa9e5a431d39ea07fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mountpoint="${1-/media/debianbackup}" | |
sudo mount "${mountpoint}" | |
mount | grep "${mountpoint}" >/dev/null | |
if [ "$?" -eq 0 ] | |
then | |
sudo rsync -aAXv /* "${1-"${mountpoint}"}" --exclude={"${HOME}"/.cache,/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,"${mountpoint}",/media/cdrom0,/lost+found} --delete | |
echo "Unmounting "${mountpoint}"" | |
sudo umount "${mountpoint}" | |
else | |
echo "ERROR : "${mountpoint}" can't be mounted. Aborting." | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment