Skip to content

Instantly share code, notes, and snippets.

@outadoc
Created August 30, 2014 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save outadoc/7fa2aab0d9d307381359 to your computer and use it in GitHub Desktop.
Save outadoc/7fa2aab0d9d307381359 to your computer and use it in GitHub Desktop.
A quick and easy-to-use incremental backup script.
#!/bin/sh
# Root path of the directory to backup
ROOT_DATA_DIR="/media/Data"
# Root path for the backup directory
ROOT_BACKUP_DIR="/media/outadoc/Stanley/Backup"
# Begin backup script, and print a quote
echo "Commencing backup procedure."
fortune -s wheatley cave_johnson glados
# Backup /media/Data/
mkdir -p $ROOT_BACKUP_DIR/Data/
rsync -avzP --delete $ROOT_DATA_DIR/ $ROOT_BACKUP_DIR/Data/
# Backup package list
mkdir -p $ROOT_BACKUP_DIR/apt/
dpkg --get-selections > $ROOT_BACKUP_DIR/apt/dpkg.list
if [ $? -ne 0 ]; then
echo "Stalemate detected. Manual core replacement required."
else
echo "Stalemate resolved. Please return to the core transfer bay."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment