Last active
December 29, 2015 08:48
-
-
Save iambibhas/7645480 to your computer and use it in GitHub Desktop.
Backup script to run on cron or on demand
This file contains hidden or 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
# Destination directory where backups should be put | |
DEST_DIR="/media/bibhas/My Passport/Backup" | |
# List of directories to backup | |
# each directory in a new line | |
DIRS="/mnt/Works/ | |
/etc/ | |
/home/bibhas/ | |
" | |
for d in $DIRS | |
do | |
echo "Backing up $d" | |
SLUG="$(echo -n "${d}" | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z)" | |
tar --exclude="venv" -cjvf "$DEST_DIR/backup$SLUG`date +"%d-%b-%y"`.tar.bz" $d | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment