Add borgmatic timer

This commit is contained in:
Benoit S 2021-02-01 20:16:00 +09:00
parent 8ee456df74
commit 40e622cf26
3 changed files with 51 additions and 0 deletions

11
files/borgmatic.service Normal file
View file

@ -0,0 +1,11 @@
[Unit]
Description=Backup with borgmatic
[Service]
Nice=19
IOSchedulingClass=idle
KillSignal=SIGINT
ExecStart=/usr/bin/borgmatic
[Install]
WantedBy=multi-user.target

10
files/borgmatic.timer Normal file
View file

@ -0,0 +1,10 @@
[Unit]
Description=Daily backup with borgmatic
[Timer]
OnCalendar=daily
RandomizedDelaySec=3600
Persistent=true
[Install]
WantedBy=multi-user.target

View file

@ -76,3 +76,33 @@ files.put(
mode='700', mode='700',
) )
files.put(
name='Push borgmatic timer',
src='files/borgmatic.timer',
dest='/etc/systemd/system/borgmatic.timer',
user='root',
group='root',
mode='644',
)
files.put(
name='Push borgmatic service',
src='files/borgmatic.service',
dest='/etc/systemd/system/borgmatic.service',
user='root',
group='root',
mode='644',
)
systemd.daemon_reload(
name='Reload systemd',
user_mode=False,
)
systemd.service(
name='Enable borgmatic timer',
service='borgmatic.timer',
running=True,
enabled=True,
)