forked from mirrors/nixpkgs
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 {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
|
|
|
@ -190,6 +190,12 @@ let
|
|||
${config.postStart}
|
||||
'';
|
||||
})
|
||||
(mkIf (config.preStop != "")
|
||||
{ serviceConfig.ExecStop = makeJobScript "${name}-pre-stop" ''
|
||||
#! ${pkgs.stdenv.shell} -e
|
||||
${config.preStop}
|
||||
'';
|
||||
})
|
||||
(mkIf (config.postStop != "")
|
||||
{ serviceConfig.ExecStopPost = makeJobScript "${name}-post-stop" ''
|
||||
#! ${pkgs.stdenv.shell} -e
|
||||
|
|
Loading…
Reference in a new issue