mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
Allow services to specify a pre-stop script
This commit is contained in:
parent
2b1f212494
commit
14cd8bc248
2 changed files with 14 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue