moved prune to backup

This commit is contained in:
2020-11-25 12:31:49 +01:00
parent 7d494902d4
commit b1926f1536
6 changed files with 11 additions and 35 deletions

View File

@@ -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

View File

@@ -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."

View File

@@ -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

View File

@@ -1,5 +1,5 @@
[Unit]
Description=borg backup
Description=restic backup
Before=restic-prune.service
[Service]

View File

@@ -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

View File

@@ -1,10 +0,0 @@
[Unit]
Description=prune restic snapshots
[Timer]
Persistent=true
OnCalendar=daily
Unit=restic-prune.service
[Install]
WantedBy=timers.target