aboutsummaryrefslogtreecommitdiff
path: root/scripts/backup.sh
blob: 51ab218df1a4949829c35f8a295c189697dba706 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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