diff options
Diffstat (limited to 'scripts/backup.sh')
-rwxr-xr-x | scripts/backup.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/backup.sh b/scripts/backup.sh new file mode 100755 index 0000000..51ab218 --- /dev/null +++ b/scripts/backup.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +OPT="-aPh" +EXCLUDE="--exclude-from=$HOME/.backup-exclude-list.txt" +LINK="--link-dest=/snapshots/$USER/latest" +SRC="/home/$USER/" +SNAP="/snapshots/$USER/" +LATEST="/snapshots/$USER/latest" +date=$(date "+%Y-%b-%d:_%T") + +[ ! -d $SNAP ] && mkdir -p $SNAP + + +rsync $OPT $LINK $EXCLUDE $SRC ${SNAP}$date + +rm -f $LATEST +ln -s ${SNAP}$date $LATEST |