diff --git a/bin/.local/bin/backup.sh b/bin/.local/bin/backup.sh new file mode 100755 index 0000000..f7234b1 --- /dev/null +++ b/bin/.local/bin/backup.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +rsync-cmd() { + if [[ -n "$1" ]]; then + dry_run="--dry-run" + fi + + rsync --verbose \ + --recursive \ + --links \ + --perms \ + --times \ + -D \ + --update \ + --delete-after \ + --compress \ + --human-readable \ + --progress \ + --partial \ + $dry_run \ + "$HOME/Progs" "$HOME/Téléchargements" tria.waarp.org:~/backup +} + +#case $1 in +# "test") +# rsync-cmd true +# ;; +# *) +# rsync-cmd +# ;; +#esac + +export BORG_REPO="tria.waarp.org:~/borg-backups" +export BORG_PASSCOMMAND='secret-tool lookup borg passphrase' + +borg create \ + --verbose \ + --filter AME \ + --list \ + --stats \ + --show-rc \ + --compression zstd,11 \ + "::$(date --iso-8601=minute)" \ + "$HOME/Progs" \ + "$HOME/Téléchargements" + +borg prune \ + --list \ + --show-rc \ + --keep-hourly 24 \ + --keep-daily 7 \ + --keep-weekly 4 \ + --keep-monthly 6 \ + --keep-yearly 1 + +borg compact +borg info diff --git a/systemd/.config/systemd/user/backups.service b/systemd/.config/systemd/user/backups.service new file mode 100644 index 0000000..22bef9d --- /dev/null +++ b/systemd/.config/systemd/user/backups.service @@ -0,0 +1,6 @@ +[Unit] +Description=Backup this computer to a remote server + +[Service] +Type=oneshot +ExecStart=%h/.local/bin/backups.sh diff --git a/systemd/.config/systemd/user/backups.timer b/systemd/.config/systemd/user/backups.timer new file mode 100644 index 0000000..9fb589c --- /dev/null +++ b/systemd/.config/systemd/user/backups.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Backup this computer to a remote server + +[Timer] +OnUnitActiveSec=15m +Unit=backups.service + +[Install] +WantedBy=timers.target diff --git a/systemd/.config/systemd/user/timers.target.wants/backups.timer b/systemd/.config/systemd/user/timers.target.wants/backups.timer new file mode 120000 index 0000000..c9a1628 --- /dev/null +++ b/systemd/.config/systemd/user/timers.target.wants/backups.timer @@ -0,0 +1 @@ +/home/bca/.config/systemd/user/backups.timer \ No newline at end of file