Add restic-report example and systemd service files
This commit is contained in:
parent
7423cdd0a8
commit
bb97797154
8 changed files with 87 additions and 33 deletions
|
@ -3,15 +3,15 @@
|
|||
dotfiles-system is a collection of helper systemd services, systemd timers and
|
||||
shell scripts for common configuration and tasks like
|
||||
|
||||
* checking if systemd services and timers are running
|
||||
* borgmatic backup
|
||||
* restic backup
|
||||
* checking if docker containers are running
|
||||
* batch docker-compose upgrades
|
||||
* docker housekeeping for removing unused docker containers, volumes and images
|
||||
* dynamic dns update
|
||||
* update check for pacman
|
||||
* memory and disk checks
|
||||
* checking if systemd services and timers are running
|
||||
* borgmatic backup
|
||||
* restic backup
|
||||
* checking if docker containers are running
|
||||
* batch docker-compose upgrades
|
||||
* docker housekeeping for removing unused docker containers, volumes and images
|
||||
* dynamic dns update
|
||||
* update check for pacman
|
||||
* memory and disk checks
|
||||
|
||||
Provided systemd services mostly support mail notifications if they have failed
|
||||
via systemd_failure_notify.
|
||||
|
|
16
etc/systemd/system/restic-report@.service
Normal file
16
etc/systemd/system/restic-report@.service
Normal file
|
@ -0,0 +1,16 @@
|
|||
[Unit]
|
||||
Description=Run restic report script for %I utilizing /etc/restic/%I/report.sh file using env /etc/restic/%I/env
|
||||
OnFailure=systemd_failure_notify@%n.service
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
Requires=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=sh /etc/restic/%I/report.sh
|
||||
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:%h/.bin"
|
||||
Environment="SSH_AUTH_SOCK=/run/user/%u/keyring/ssh"
|
||||
EnvironmentFile=/etc/restic/%I/env
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
9
etc/systemd/system/restic-report@.timer
Normal file
9
etc/systemd/system/restic-report@.timer
Normal file
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=Run restic report script for %I utilizing /etc/restic/%I/report.sh file using env /etc/restic/%I/env
|
||||
|
||||
[Timer]
|
||||
OnCalendar=Sun 01:00:00
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
16
etc/systemd/user/restic-report@.service
Normal file
16
etc/systemd/user/restic-report@.service
Normal file
|
@ -0,0 +1,16 @@
|
|||
[Unit]
|
||||
Description=Run restic report script for %I utilizing ~/.config/restic/%I/report.sh file using env ~/.config/restic/%I/env
|
||||
OnFailure=systemd_failure_notify@%n.service
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
Requires=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=sh %h/.config/restic/%I/report.sh
|
||||
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:%h/.bin"
|
||||
Environment="SSH_AUTH_SOCK=/run/user/%u/keyring/ssh"
|
||||
EnvironmentFile=%h/.config/restic/%I/env
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
9
etc/systemd/user/restic-report@.timer
Normal file
9
etc/systemd/user/restic-report@.timer
Normal file
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=Run restic report script for %I utilizing ~/.config/restic/%I/report.sh file using env ~/.config/restic/%I/env
|
||||
|
||||
[Timer]
|
||||
OnCalendar=Sun 01:00:00
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
|
@ -16,3 +16,4 @@ RESTIC_KEEP="--keep-daily 7 --keep-weekly 4 --keep-monthly 3"
|
|||
|
||||
# advanced parameters
|
||||
RESTIC_ADDITIONAL_CREATE_PARAMS="--one-file-system"
|
||||
#RESTIC_REPORT_MAIL=monitoring@mydomain.tld
|
||||
|
|
14
usr/share/doc/dotfiles-system/restic/mybackup/report.sh
Executable file
14
usr/share/doc/dotfiles-system/restic/mybackup/report.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# adapt to your needs
|
||||
# this serves as an example and assumes configured mailx
|
||||
|
||||
SNAPSHOTS=$(/usr/bin/restic snapshots -c)
|
||||
STATS=$(/usr/bin/restic stats)
|
||||
|
||||
# output for stdin (service)
|
||||
echo -e "$STATS\n\n$SNAPSHOTS"
|
||||
|
||||
# output for mail
|
||||
me="$0"
|
||||
echo -e "$STATS\n\n$SNAPSHOTS" | mailx -Ssendwait -s "[restic - $(hostname)] $me - REPORT" "${RESTIC_REPORT_MAIL}"
|
|
@ -2,32 +2,21 @@
|
|||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
dotfiles\-system is a collection of helper systemd services, systemd timers and shell scripts for common configuration and tasks like
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
checking if systemd services and timers are running
|
||||
.IP "" 4
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
borgmatic backup
|
||||
.nf
|
||||
|
||||
* checking if systemd services and timers are running
|
||||
* borgmatic backup
|
||||
* restic backup
|
||||
* checking if docker containers are running
|
||||
* batch docker\-compose upgrades
|
||||
* docker housekeeping for removing unused docker containers, volumes and images
|
||||
* dynamic dns update
|
||||
* update check for pacman
|
||||
* memory and disk checks
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
restic backup
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
checking if docker containers are running
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
batch docker\-compose upgrades
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
docker housekeeping for removing unused docker containers, volumes and images
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
dynamic dns update
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
update check for pacman
|
||||
.
|
||||
.IP "\(bu" 4
|
||||
memory and disk checks
|
||||
.fi
|
||||
.
|
||||
.IP "" 0
|
||||
.
|
||||
|
|
Loading…
Reference in a new issue