Add support for forking services

This commit is contained in:
Jaka Hudoklin 2014-03-14 16:37:23 +00:00
parent 3b862ceec3
commit aba8854afc
2 changed files with 5 additions and 1 deletions

View File

@ -27,6 +27,9 @@ let
default = 1;
example = 0;
};
pidfile = mkOption {
default = null;
};
};
};
services = config.supervisord.services;
@ -78,7 +81,7 @@ in {
in
''
[program:${name}]
command=${cfg.command}
command=${if cfg.pidfile == null then cfg.command else "${pkgs.pythonPackages.supervisor}/bin/pidproxy ${cfg.pidfile} ${cfg.command}"}
environment=${concatStrings
(mapAttrsToList (name: value: "${name}=\"${value}\",") (
cfg.environment // { PATH = concatStringsSep ":"

View File

@ -57,6 +57,7 @@ in {
stopsignal = if hasAttr "KillSignal" cfg.serviceConfig then
substring 3 (stringLength cfg.serviceConfig.KillSignal) cfg.serviceConfig.KillSignal
else "TERM";
pidfile = if hasAttr "PIDFile" cfg.serviceConfig then cfg.serviceConfig.PIDFile else null;
};
}
) (attrNames (filterAttrs (n: v: v.enable) runServices)));