Add systemd configuration
parent
57049acab3
commit
ec691ebcaf
24
README.md
24
README.md
|
|
@ -16,7 +16,29 @@ Ensure restrictive permissions on this file as it exposes the passphrase.
|
||||||
chown root. config.sh
|
chown root. config.sh
|
||||||
chmod 600 config.sh
|
chmod 600 config.sh
|
||||||
|
|
||||||
Example cron jobs:
|
# Scheduling
|
||||||
|
## systemd
|
||||||
|
Copy the example systemd [unit files](systemd/) to `/etc/systemd/system/`. Then for each
|
||||||
|
configuration file in `/etc/borgwrapper/<config_name>.sh` do:
|
||||||
|
|
||||||
|
systemctl enable borgwrapper-backup@<config_name>.timer
|
||||||
|
systemctl enable borgwrapper-verify@<config_name>.timer
|
||||||
|
|
||||||
|
systemctl start borgwrapper-backup@<config_name>.timer
|
||||||
|
systemctl start borgwrapper-verify@<config_name>.timer
|
||||||
|
|
||||||
|
You can view the backup logs with:
|
||||||
|
|
||||||
|
journalctl -xu borgwrapper-backup@<config_name>
|
||||||
|
journalctl -xu borgwrapper-verify@<config_name>
|
||||||
|
|
||||||
|
If you want to run the tasks manually outside the timers you can just start them like usual
|
||||||
|
services:
|
||||||
|
|
||||||
|
systemctl start borgwrapper-backup@<config_name>
|
||||||
|
systemctl start borgwrapper-verify@<config_name>
|
||||||
|
|
||||||
|
## Cron (use only if systemd is not available)
|
||||||
|
|
||||||
# Run the backup daily
|
# Run the backup daily
|
||||||
23 1 * * * /usr/local/bin/borgwrapper backup
|
23 1 * * * /usr/local/bin/borgwrapper backup
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Run borgwrapper backup (config: %i)
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/local/bin/borgwrapper -c /etc/borgwrapper/%i.sh backup
|
||||||
|
User=root
|
||||||
|
Group=root
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Start daily borgwrapper backup
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=daily
|
||||||
|
RandomizedDelaySec=6h
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Verify borgwrapper backup (config: %i)
|
||||||
|
After=network.target borgwrapper-backup@%i.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/local/bin/borgwrapper -c /etc/borgwrapper/%i.sh verify
|
||||||
|
User=root
|
||||||
|
Group=root
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Start monthly borgwrapper backup verification
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=monthly
|
||||||
|
RandomizedDelaySec=14d
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Loading…
Reference in New Issue