diff options
author | Guangxiong Lin <[email protected]> | 2021-11-18 23:21:06 +0800 |
---|---|---|
committer | Guangxiong Lin <[email protected]> | 2021-11-18 23:21:06 +0800 |
commit | c60297e6481019fb3d936b561596ba3bfda7db70 (patch) | |
tree | 67b3546ea4a33d8bd0c9755510b068a7855cc85e | |
parent | aeba95ae383270b2c272ae6dde635b6d91999054 (diff) | |
download | dotfiles-c60297e6481019fb3d936b561596ba3bfda7db70.tar.gz dotfiles-c60297e6481019fb3d936b561596ba3bfda7db70.tar.bz2 dotfiles-c60297e6481019fb3d936b561596ba3bfda7db70.zip |
Add backup scripts
-rwxr-xr-x | scripts/backup.sh | 17 | ||||
-rwxr-xr-x | scripts/bootstrap.sh (renamed from bootstrap.sh) | 0 |
2 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 diff --git a/bootstrap.sh b/scripts/bootstrap.sh index fdc8003..fdc8003 100755 --- a/bootstrap.sh +++ b/scripts/bootstrap.sh |