s6-rc: use s6-rc stop
instead of exiting 125 in the no-restart branch of "restartCondition = on-failure"
exiting 125 stops the service, but does NOT put it in the down state, preventing it from being re-started
This commit is contained in:
@@ -251,19 +251,14 @@ let
|
|||||||
down = maybe (type == "oneshot") service.cleanupCommand;
|
down = maybe (type == "oneshot") service.cleanupCommand;
|
||||||
finish = maybe (type == "longrun") (concatNonNullLines [
|
finish = maybe (type == "longrun") (concatNonNullLines [
|
||||||
service.cleanupCommand
|
service.cleanupCommand
|
||||||
(
|
(maybe (service.restartCondition == "on-failure") ''
|
||||||
if service.restartCondition == "always" then null
|
if [ "$1" -eq 0 ]; then
|
||||||
else if service.restartCondition == "on-failure" then ''
|
|
||||||
if [ $1 -eq 0 ]; then
|
|
||||||
# `man s6-service-directory` says to exit 125 to indicate "permanent failure" equivalent to `s6-svc -O`.
|
|
||||||
# i do this with the opposite intent though, trying to indicate "permanent success"...
|
|
||||||
printf "service exited 0: not restarting\n"
|
printf "service exited 0: not restarting\n"
|
||||||
exit 125
|
s6-rc stop "$3"
|
||||||
else
|
else
|
||||||
printf "service exited non-zero: restarting (code: %d)\n" "$1"
|
printf "service exited non-zero: restarting (code: %d)\n" "$1"
|
||||||
fi
|
fi
|
||||||
'' else throw "unknown service.restartCondition '${service.restartCondition}'"
|
'')
|
||||||
)
|
|
||||||
]);
|
]);
|
||||||
run = service.command;
|
run = service.command;
|
||||||
up = service.startCommand;
|
up = service.startCommand;
|
||||||
|
Reference in New Issue
Block a user