aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuangxiong Lin <[email protected]>2021-11-18 23:21:06 +0800
committerGuangxiong Lin <[email protected]>2021-11-18 23:21:06 +0800
commitc60297e6481019fb3d936b561596ba3bfda7db70 (patch)
tree67b3546ea4a33d8bd0c9755510b068a7855cc85e
parentaeba95ae383270b2c272ae6dde635b6d91999054 (diff)
downloaddotfiles-c60297e6481019fb3d936b561596ba3bfda7db70.tar.gz
dotfiles-c60297e6481019fb3d936b561596ba3bfda7db70.tar.bz2
dotfiles-c60297e6481019fb3d936b561596ba3bfda7db70.zip
Add backup scripts
-rwxr-xr-xscripts/backup.sh17
-rwxr-xr-xscripts/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