Support postStart scripts in service units

This commit is contained in:
Eelco Dolstra 2012-10-01 16:45:49 -04:00
parent 891be375b5
commit 13d747c11a
2 changed files with 16 additions and 0 deletions

View file

@ -122,6 +122,15 @@ with pkgs.lib;
'';
};
postStart = mkOption {
type = types.string;
default = "";
description = ''
Shell commands executed after the service's main process
is started.
'';
};
restartIfChanged = mkOption {
type = types.bool;
default = true;

View file

@ -229,6 +229,13 @@ let
''}
''}
${optionalString (def.postStart != "") ''
ExecStartPost=${makeJobScript "${name}-poststart.sh" ''
#! ${pkgs.stdenv.shell} -e
${def.postStart}
''}
''}
${attrsToSection def.serviceConfig}
'';
};