aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorStefan Tatschner <stefan@sevenbyte.org>2015-03-30 00:45:55 +0200
committerStefan Tatschner <stefan@sevenbyte.org>2015-03-30 00:51:06 +0200
commitda0b78c67a19aa1dbef43e877e975efa765578bd (patch)
treeab08d436a8d063039a2ff98cb727f4b999c2cd08 /etc
parent520bb74626541bc400f78b92d31f9a534bb2e579 (diff)
downloadsyncthing-da0b78c67a19aa1dbef43e877e975efa765578bd.tar.gz
syncthing-da0b78c67a19aa1dbef43e877e975efa765578bd.zip
systemd: Fix error code definitions to prevent failed units
The systemd exit code definitions (introduced in c586a17, refs #1324) caused problems. Per default systemd considers a return code != 0 as failed. So when you click on "Restart" in the WebUI an error appears: systemd[953]: syncthing.service: main process exited, code=exited, status=3/NOTIMPLEMENTED systemd[953]: Unit syncthing.service entered failed state. systemd[953]: syncthing.service failed. systemd[953]: syncthing.service holdoff time over, scheduling restart. systemd[953]: Started Syncthing - Open Source Continuous File Synchronization. systemd[953]: Starting Syncthing - Open Source Continuous File Synchronization... syncthing[13222]: [LFKUK] INFO: syncthing v0.10.30 (go1.4.2 linux-amd64 default) builduser@jara 2015-03-29 07:46:44 UTC To fix this error we have to add the "succes codes" 2, 3, 4 to "SuccessExitStatus": syncthing[13006]: [LFKUK] INFO: Restarting syncthing[13006]: [LFKUK] OK: Exiting systemd[953]: syncthing.service holdoff time over, scheduling restart. systemd[953]: Started Syncthing - Open Source Continuous File Synchronization. systemd[953]: Starting Syncthing - Open Source Continuous File Synchronization... syncthing[13031]: [LFKUK] INFO: syncthing v0.10.30 (go1.4.2 linux-amd64 default) builduser@jara 2015-03-29 07:46:44 UTC To make sure that syncthing restarts in case of error, and to make sure that "Restart=on-failure" actually works, let's remove "RestartPreventExitStatus=1". Systemd considers this as an error per default and the restart will be triggered successfully.
Diffstat (limited to 'etc')
-rw-r--r--etc/linux-systemd/system/syncthing@.service3
-rw-r--r--etc/linux-systemd/user/syncthing.service3
2 files changed, 2 insertions, 4 deletions
diff --git a/etc/linux-systemd/system/syncthing@.service b/etc/linux-systemd/system/syncthing@.service
index 5f87c322c..f5ecf1972 100644
--- a/etc/linux-systemd/system/syncthing@.service
+++ b/etc/linux-systemd/system/syncthing@.service
@@ -8,8 +8,7 @@ User=%i
Environment=STNORESTART=yes
ExecStart=/usr/bin/syncthing -no-browser -logflags=0
Restart=on-failure
-RestartPreventExitStatus=1
-SuccessExitStatus=2
+SuccessExitStatus=2 3 4
RestartForceExitStatus=3 4
[Install]
diff --git a/etc/linux-systemd/user/syncthing.service b/etc/linux-systemd/user/syncthing.service
index 676f1653c..eedbed22b 100644
--- a/etc/linux-systemd/user/syncthing.service
+++ b/etc/linux-systemd/user/syncthing.service
@@ -7,8 +7,7 @@ After=network.target
Environment=STNORESTART=yes
ExecStart=/usr/bin/syncthing -no-browser -logflags=0
Restart=on-failure
-RestartPreventExitStatus=1
-SuccessExitStatus=2
+SuccessExitStatus=2 3 4
RestartForceExitStatus=3 4
[Install]