Skip to content

Instantly share code, notes, and snippets.

@karlp
Created November 13, 2012 20:03
Show Gist options
  • Save karlp/4068030 to your computer and use it in GitHub Desktop.
Save karlp/4068030 to your computer and use it in GitHub Desktop.
Karl's kinda simplistic backupsss
#!/bin/bash
# Karl's very simplistic backup script...
REALLY=$1
REAL_FLAGS=-avh
DEMO_FLAGS=-avnh
# "arx2011" is the volume name of my second harddisk
MOUNTED=$(mount | grep arx2011)
if [[ -z $MOUNTED ]]
then
echo "You really should mount the backup mount first..."
exit 2
fi
if [[ $REALLY = "really" ]]
then
echo "OK, REALLY then!"
# These are the directories that are backed up...
rsync $REAL_FLAGS --delete-delay $HOME/photos /media/arx2011
rsync $REAL_FLAGS --delete-delay $HOME/{Documents,Pictures,mapping} /media/arx2011/docs_things
exit 0
fi
echo " Review this: "
rsync $DEMO_FLAGS --delete-delay $HOME/photos /media/arx2011
rsync $DEMO_FLAGS --delete-delay $HOME/{Documents,Pictures,mapping} /media/arx2011/docs_things
echo ""
echo " REVIEW WHAT THAT JUST DID, then...."
echo " just run $0 really"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment