Create a gist now

Instantly share code, notes, and snippets.

@NiklasMM /backup.sh
Last active Dec 26, 2015

What would you like to do?
One line file backup script
#!/bin/bash
SOURCE_DIR=/home/niklas/
TARGET_DIR=/media/Backup/FileBackup
EXCLUDE_FILE=/home/niklas/rsync_excludelist
rsync -avP --exclude-from=${EXCLUDE_FILE} --delete-excluded --delete --stats ${SOURCE_DIR} ${TARGET_DIR}
# add log entry to target dir
LOGFILE="$TARGET_DIR/backup_log"
DATE=$(date)
echo "Last backup on $DATE" >> $LOGFILE
Owner

NiklasMM commented Oct 23, 2013

Obviously you have to adjust the paths...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment