(Scripts|SystemD)~rework backup system
This is purely for the desktop: only enable if you fix it up.
This commit is contained in:
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
set -xe
|
set -xe
|
||||||
|
|
||||||
dir=$2/backup
|
dir=/media/hdd/backup
|
||||||
arch=$2/archive
|
|
||||||
name="$(date +%F)-$(date +%T)-$(basename $1).tar.xz"
|
name="$(date +%F)-$(date +%T)-$(basename $1).tar.xz"
|
||||||
|
|
||||||
XZ_OPT='-T0 -9' tar -Jcvf $dir/$name $1
|
XZ_OPT='-T0 -9' tar -Jcvf $dir/$name $1
|
||||||
|
|||||||
15
Scripts/.local/scripts/do_backup
Executable file
15
Scripts/.local/scripts/do_backup
Executable 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
|
||||||
|
|
||||||
@@ -3,4 +3,4 @@ Description=Taking backup
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=/usr/bin/rsync -a --delete --quiet /home/oreo /media/hdd/backup
|
ExecStart=%h/.local/scripts/do_backup
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ Description=Run backup weekly
|
|||||||
[Timer]
|
[Timer]
|
||||||
OnBootSec=15min
|
OnBootSec=15min
|
||||||
OnUnitActiveSec=1w
|
OnUnitActiveSec=1w
|
||||||
|
Unit=backup.service
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=timers.target
|
WantedBy=timers.target
|
||||||
|
|||||||
Reference in New Issue
Block a user