From b1926f1536fe05a18dae176ae12a796a975c9195 Mon Sep 17 00:00:00 2001 From: Marco Kundt Date: Wed, 25 Nov 2020 12:31:49 +0100 Subject: [PATCH] moved prune to backup --- restic/.bin/restic_backup | 9 ++++++++- restic/.bin/restic_common | 4 ++-- restic/.bin/restic_prune | 11 ----------- restic/.config/systemd/user/restic-backup.service | 2 +- restic/.config/systemd/user/restic-prune.service | 10 ---------- restic/.config/systemd/user/restic-prune.timer | 10 ---------- 6 files changed, 11 insertions(+), 35 deletions(-) delete mode 100755 restic/.bin/restic_prune delete mode 100644 restic/.config/systemd/user/restic-prune.service delete mode 100644 restic/.config/systemd/user/restic-prune.timer diff --git a/restic/.bin/restic_backup b/restic/.bin/restic_backup index 64866c1..486b5ba 100755 --- a/restic/.bin/restic_backup +++ b/restic/.bin/restic_backup @@ -2,6 +2,13 @@ source $HOME/.bin/restic_common -info "Starting backup" restic -r $RESTIC_REPOSITORY unlock + +info "Starting backup" restic --cache-dir $CACHE_DIR -r $RESTIC_REPOSITORY backup $BACKUP_PATHS $BACKUP_EXCLUDES + +info "Forgetting snapshots" +restic --cache-dir $CACHE_DIR -r $RESTIC_REPOSITORY forget --keep-hourly $KEEP_HOURS --keep-daily $KEEP_DAYS --keep-weekly $KEEP_WEEKS --keep-monthly $KEEP_WEEKS --keep-yearly $KEEP_YEARS + +info "Pruning snapshots" +restic --cache-dir $CACHE_DIR -r $RESTIC_REPOSITORY prune \ No newline at end of file diff --git a/restic/.bin/restic_common b/restic/.bin/restic_common index 564ad4d..c4774f3 100755 --- a/restic/.bin/restic_common +++ b/restic/.bin/restic_common @@ -38,7 +38,7 @@ ping -c 3 192.168.178.100 &> /dev/null if [[ $? > 0 ]]; then - ping -c 3 1.1.1.1 &> /dev/null + ping -c 3 10.0.1.3 &> /dev/null if [[ $? > 0 ]]; then info "Not connected." @@ -47,4 +47,4 @@ if [[ $? > 0 ]]; then fi echo "Done" -read_config +read_config \ No newline at end of file diff --git a/restic/.bin/restic_prune b/restic/.bin/restic_prune deleted file mode 100755 index 53ba722..0000000 --- a/restic/.bin/restic_prune +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -source $HOME/.bin/restic_common - -info "Forgetting snapshots" -restic -r $RESTIC_REPOSITORY unlock -restic --cache-dir $CACHE_DIR -r $RESTIC_REPOSITORY forget --keep-hourly $KEEP_HOURS --keep-daily $KEEP_DAYS --keep-weekly $KEEP_WEEKS --keep-monthly $KEEP_WEEKS --keep-yearly $KEEP_YEARS - -info "Pruning snapshots" -restic -r $RESTIC_REPOSITORY unlock -restic --cache-dir $CACHE_DIR -r $RESTIC_REPOSITORY prune diff --git a/restic/.config/systemd/user/restic-backup.service b/restic/.config/systemd/user/restic-backup.service index 8c65abf..da20009 100644 --- a/restic/.config/systemd/user/restic-backup.service +++ b/restic/.config/systemd/user/restic-backup.service @@ -1,5 +1,5 @@ [Unit] -Description=borg backup +Description=restic backup Before=restic-prune.service [Service] diff --git a/restic/.config/systemd/user/restic-prune.service b/restic/.config/systemd/user/restic-prune.service deleted file mode 100644 index ea3929b..0000000 --- a/restic/.config/systemd/user/restic-prune.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=prune borg snapshots -After=restic-backup.service - -[Service] -Type=oneshot -ExecStart=%h/.bin/restic_prune - -[Install] -WantedBy=multi-user.target diff --git a/restic/.config/systemd/user/restic-prune.timer b/restic/.config/systemd/user/restic-prune.timer deleted file mode 100644 index e0a69cf..0000000 --- a/restic/.config/systemd/user/restic-prune.timer +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=prune restic snapshots - -[Timer] -Persistent=true -OnCalendar=daily -Unit=restic-prune.service - -[Install] -WantedBy=timers.target