aboutsummaryrefslogtreecommitdiff
path: root/Scripts/.local/scripts/do_backup
blob: 3f795ae66b477460b25d0fc54e5a866f50ed2c01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env sh

set -xe

dir="/media/hdd/backup/$(date +%Y)/$(date +%m)-$(date +%d)"
folders="$HOME/Dotfiles $HOME/Downloads $HOME/Media $HOME/Pictures $HOME/Projects $HOME/Text"

mkdir -p $dir

if ! xset -q &> /dev/null
then
    echo "do_backup: Starting backup (stored at $dir)"
else
    notify-send "do_backup: Starting backup (stored at $dir)"
fi

for name in $folders
do
  out_name=$dir/$(basename $name).tar.xz
  XZ_OPT='-T0 -9' tar -Jcvf $out_name -C $name .
done

if ! xset -q &> /dev/null
then
    echo "do_backup: Finished backup"
else
    notify-send "do_backup: Finished backup"
fi