(Scripts|SystemD)~rework backup system

This is purely for the desktop: only enable if you fix it up.
This commit is contained in:
2023-10-06 01:16:47 +01:00
parent 9e975839fe
commit d88430aa8a
4 changed files with 18 additions and 3 deletions

View File

@@ -2,8 +2,7 @@
set -xe
dir=$2/backup
arch=$2/archive
dir=/media/hdd/backup
name="$(date +%F)-$(date +%T)-$(basename $1).tar.xz"
XZ_OPT='-T0 -9' tar -Jcvf $dir/$name $1

View File

@@ -0,0 +1,15 @@
#!/usr/bin/env sh
set -xe
dir="/media/hdd/backup/$(date +%F)/$(date +%T)"
folders="$HOME/Code $HOME/Dotfiles $HOME/Downloads $HOME/Media $HOME/Pictures $HOME/Projects $HOME/Text"
mkdir -p $dir
for name in $folders
do
out_name=$dir/$(basename $name).tar.xz
XZ_OPT='-T0 -9' tar -Jcvf $out_name -C $name .
done

View File

@@ -3,4 +3,4 @@ Description=Taking backup
[Service]
Type=simple
ExecStart=/usr/bin/rsync -a --delete --quiet /home/oreo /media/hdd/backup
ExecStart=%h/.local/scripts/do_backup

View File

@@ -4,6 +4,7 @@ Description=Run backup weekly
[Timer]
OnBootSec=15min
OnUnitActiveSec=1w
Unit=backup.service
[Install]
WantedBy=timers.target