@@ -3,13 +3,6 @@
|
|||||||
. $HOME/.bin/restic_common
|
. $HOME/.bin/restic_common
|
||||||
export RESTIC_PASSWORD="${RESTIC_PASSWORD}"
|
export RESTIC_PASSWORD="${RESTIC_PASSWORD}"
|
||||||
|
|
||||||
restic -r $RESTIC_REPOSITORY unlock
|
|
||||||
|
|
||||||
info "Starting backup"
|
info "Starting backup"
|
||||||
|
restic -r $RESTIC_REPOSITORY unlock
|
||||||
restic --cache-dir $CACHE_DIR -r $RESTIC_REPOSITORY backup $BACKUP_PATHS $BACKUP_EXCLUDES
|
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
|
|
||||||
@@ -40,7 +40,7 @@ ping -c 3 192.168.178.100 &> /dev/null
|
|||||||
|
|
||||||
if [[ $? > 0 ]]; then
|
if [[ $? > 0 ]]; then
|
||||||
|
|
||||||
ping -c 3 10.0.1.3 &> /dev/null
|
ping -c 3 1.1.1.1 &> /dev/null
|
||||||
|
|
||||||
if [[ $? > 0 ]]; then
|
if [[ $? > 0 ]]; then
|
||||||
info "Not connected."
|
info "Not connected."
|
||||||
|
|||||||
11
restic/.bin/restic_prune
Executable file
11
restic/.bin/restic_prune
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/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
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=restic backup
|
Description=borg backup
|
||||||
Before=restic-prune.service
|
Before=restic-prune.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
|||||||
10
restic/.config/systemd/user/restic-prune.service
Normal file
10
restic/.config/systemd/user/restic-prune.service
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=prune borg snapshots
|
||||||
|
After=restic-backup.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=%h/.bin/restic_prune
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
10
restic/.config/systemd/user/restic-prune.timer
Normal file
10
restic/.config/systemd/user/restic-prune.timer
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=prune restic snapshots
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
Persistent=true
|
||||||
|
OnCalendar=daily
|
||||||
|
Unit=restic-prune.service
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
Reference in New Issue
Block a user