Add support for postStop scripts

This commit is contained in:
Eelco Dolstra 2012-10-10 17:55:13 -04:00
parent e9b221c2ff
commit 62b707de07
2 changed files with 16 additions and 0 deletions

View File

@ -145,6 +145,15 @@ rec {
'';
};
postStop = mkOption {
type = types.string;
default = "";
description = ''
Shell commands executed after the service's main process
has exited.
'';
};
restartIfChanged = mkOption {
type = types.bool;
default = true;

View File

@ -250,6 +250,13 @@ let
''}
''}
${optionalString (def.postStop != "") ''
ExecStopPost=${makeJobScript "${name}-poststop.sh" ''
#! ${pkgs.stdenv.shell} -e
${def.postStop}
''}
''}
${attrsToSection def.serviceConfig}
'';
};