Allow services to specify a pre-stop script
This commit is contained in:
parent
2b1f212494
commit
14cd8bc248
@ -210,6 +210,14 @@ in rec {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
preStop = mkOption {
|
||||||
|
type = types.lines;
|
||||||
|
default = "";
|
||||||
|
description = ''
|
||||||
|
Shell commands executed to stop the service.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
postStop = mkOption {
|
postStop = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
|
@ -190,6 +190,12 @@ let
|
|||||||
${config.postStart}
|
${config.postStart}
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
(mkIf (config.preStop != "")
|
||||||
|
{ serviceConfig.ExecStop = makeJobScript "${name}-pre-stop" ''
|
||||||
|
#! ${pkgs.stdenv.shell} -e
|
||||||
|
${config.preStop}
|
||||||
|
'';
|
||||||
|
})
|
||||||
(mkIf (config.postStop != "")
|
(mkIf (config.postStop != "")
|
||||||
{ serviceConfig.ExecStopPost = makeJobScript "${name}-post-stop" ''
|
{ serviceConfig.ExecStopPost = makeJobScript "${name}-post-stop" ''
|
||||||
#! ${pkgs.stdenv.shell} -e
|
#! ${pkgs.stdenv.shell} -e
|
||||||
|
Loading…
Reference in New Issue
Block a user