Skip to content

Instantly share code, notes, and snippets.

@jedie
Created May 5, 2014 15:36
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 jedie/be43421f351374b28d96 to your computer and use it in GitHub Desktop.
Save jedie/be43421f351374b28d96 to your computer and use it in GitHub Desktop.
#!/bin/bash
DEST_PATH="/media/your/external/mount/"
RELEASE=$(cat /etc/debian_version | python -c "import sys;print sys.stdin.read().split('/')[0]")
FILENAME="$(date +%Y-%m-%d) $(uname -nr) ${RELEASE} Backup.tar.lzma"
FILENAME=$(echo ${FILENAME} | tr " " "_")
DESTINATION=${DEST_PATH}${FILENAME}
EXCLUDE="
--exclude=/dev/*
--exclude=/proc/*
--exclude=/sys/*
--exclude=/media/*
--exclude=/mnt/*
--exclude=/run/*
--exclude=/tmp/*
--exclude=/lost+found/*
--exclude=/var/cache/*
--exclude=/var/lib/apt/lists/*dists*
--exclude=/var/run/*
--exclude=/var/tmp/*
--exclude=/var/log/*
--exclude=/.Trash*
--exclude=*.tmp
--exclude=*.pyc
"
set -x
sudo tar cvpfa ${DESTINATION} ${EXCLUDE} /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment