You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
891 B
Bash

#!/bin/bash
# variables
BACKUP_PATH=/media/isabell/Elements\ SE/isabell_tuxedo/
NOBACKUP_FILE=$(dirname "${BASH_SOURCE[0]}")/.nobackup # in same directory as the home_backup.sh script
# backup execution
if [[ -d "$BACKUP_PATH" ]] && echo "Starting rsync backup of home directory to $BACKUP_PATH"; then
if [[ -f "$NOBACKUP_FILE" ]] && echo "Found $NOBACKUP_FILE file, proceeding? (y/n)"; then
read PROCEEDING
if [[ "$PROCEEDING" == "y" ]]; then
rsync -av --delete --filter 'dir-merge,- $NOBACKUP_FILE' "$HOME/" "$BACKUP_PATH"
fi
else
echo "No $NOBACKUP_FILE found, proceeding to back-up entire home directory? (y/n)"
read PROCEEDING
if [[ "$PROCEEDING" == "y" ]]; then
rsync -av --delete "$HOME/" "$BACKUP_PATH"
fi
fi
else
echo "Device or location designated for the backup does not exist."
fi