🚑 critically fixed bash syntax in file + added feature of excluding directories from the backup listed in ".nobackup" file
parent
7df5b74541
commit
af957a3697
@ -0,0 +1,3 @@
|
|||||||
|
/home/isabell/.cache/
|
||||||
|
/home/isabell/.steam/
|
||||||
|
/home/isabell/.xsession-errors
|
@ -1,14 +1,23 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# variables
|
# variables
|
||||||
BACKUP_PATH="/media/isabell/Elements\ SE/isabell_tuxedo/"
|
BACKUP_PATH=/media/isabell/Elements\ SE/isabell_tuxedo/
|
||||||
# EXCLUDED_DIRS={}
|
NOBACKUP_FILE=.nobackup
|
||||||
|
|
||||||
# backup execution
|
# backup execution
|
||||||
if [[ -f $BACKUP_PATH ]] && echo "Starting rsync backup of home directory to $BACKUP_PATH"; then
|
if [[ -d "$BACKUP_PATH" ]] && echo "Starting rsync backup of home directory to $BACKUP_PATH"; then
|
||||||
#if [ "$EXCLUDED_DIRS" = "" ]; then
|
if [[ -f "$NOBACKUP_FILE" ]] && echo "Found $NOBACKUP_FILE file, proceeding? (y/n)"; then
|
||||||
rsync -av --delete $HOME $BACKUP_PATH
|
read PROCEEDING
|
||||||
#fi
|
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
|
else
|
||||||
echo "Device or location designated for the backup does not exist."
|
echo "Device or location designated for the backup does not exist."
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue