commit 7d63161f752022cab3df8b53337b79f9c349ba93
parent 50250906d1923fc4607014f28d9d8e1bfe169c79
Author: Leah Thein <leah@toaster.fritz.box>
Date: Sat, 5 Dec 2020 08:37:58 +0100
parent 50250906d1923fc4607014f28d9d8e1bfe169c79
Author: Leah Thein <leah@toaster.fritz.box>
Date: Sat, 5 Dec 2020 08:37:58 +0100
remove pidfile on quit
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/oeffi_nojs.nim b/src/oeffi_nojs.nim @@ -15,9 +15,13 @@ import endpoints/api/refreshJourney import types, backend/hafas, formaters/formaters +proc removePidFile() = + if getEnv("PID_FILE") != "": + removeFile(getEnv("PID_FILE")) proc CtrlCHook() {.noconv.} = echo "Ctrl+C fired! \nStopping Server now!" + removePidFile() quit() proc main = # for gcsafe @@ -25,6 +29,7 @@ proc main = # for gcsafe onSignal(SIGTERM): echo "Got SIGTERM! \nStopping Server now!" + removePidFile() quit() if getEnv("CACHE_PATH") == "":