I have to be honest, I am a bit confused. I read [1] and [2] and am well aware that SIGINT should trigger an exit code 130:
But is this true for restic mount
? I have a setup where a Samba server serves the backup which is provided by restic mount
(similar to the user in the topic βt/make-restic-mount-message-configurable/609β on this forum - i can not link to it, as I am a new user ) but in my case I created a systemd unit where the repository is automatically exposed via restic mount
on boot. My systemd unit file now looks like this:
# /etc/systemd/system/restic-mount.service
[Unit]
Description=Restic Mount Backup Service
After=syslog.target
After=network.target
[Service]
Type=simple
User=root
Group=root
ExecStart=/usr/local/bin/restic mount --allow-other --snapshot-template "20060102T150405" --password-file /root/.restic_data_password -r /srv/backups/restic/server01 /srv/snap
Restart=always
RestartSec=10
KillMode=process
KillSignal=SIGINT
SuccessExitStatus=130
TimeoutStopSec=5
[Install]
WantedBy=multi-user.target
and running systemctl {start|stop} restic-mount.service
seems to work fine. But without the SuccessExitStatus=130
line, stopping the service failed. (KillMode
and KillSignal
was tricky too (is there a better way to unmount the repository?), but this must not be addressed now.)
β restic-mount.service - Restic Mount Backup Service
Loaded: loaded (/etc/systemd/system/restic-mount.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2018-09-27 14:40:50 CEST; 1s ago
Process: 11280 ExecStart=/usr/local/bin/restic mount --allow-other --snapshot-template 20060102T150405 --password-file /root/.restic_data_password -r /srv/backups/restic/server01
Main PID: 11280 (code=exited, status=130)
Sep 27 14:37:25 backup01 systemd[1]: Started Restic Mount Backup Service.
Sep 27 14:37:38 backup01 restic[11280]: Now serving the repository at /srv/snapshots
Sep 27 14:37:38 backup01 restic[11280]: Don't forget to umount after quitting!
Sep 27 14:40:50 backup01 restic[11280]: [42B blob data]
Sep 27 14:40:50 backup01 systemd[1]: Stopping Restic Mount Backup Service...
Sep 27 14:40:50 backup01 systemd[1]: restic-mount.service: Main process exited, code=exited, status=130/n/a
Sep 27 14:40:50 backup01 systemd[1]: Stopped Restic Mount Backup Service.
Sep 27 14:40:50 backup01 systemd[1]: restic-mount.service: Unit entered failed state.
Sep 27 14:40:50 backup01 systemd[1]: restic-mount.service: Failed with result 'exit-code'.
So the obvious questions are, should restic mount
exit with Exit code 130? Or is there a better way to accomplish my task?