Shorten filenames of start scripts to make log messages more readable

This commit is contained in:
Eelco Dolstra 2012-07-19 17:41:42 -04:00
parent ae62436697
commit 02e37ba6b0
2 changed files with 11 additions and 7 deletions

View File

@ -255,6 +255,8 @@ let
KillSignal=SIGHUP
'';
makeJobScript = name: content: "${pkgs.writeScriptBin name content}/bin/${name}";
serviceToUnit = name: def:
{ inherit (def) wantedBy;
@ -274,14 +276,14 @@ let
${concatMapStrings (n: "Environment=${n}=${getAttr n def.environment}\n") (attrNames def.environment)}
${optionalString (def.preStart != "") ''
ExecStartPre=${pkgs.writeScript "${name}-prestart.sh" ''
ExecStartPre=${makeJobScript "${name}-prestart.sh" ''
#! ${pkgs.stdenv.shell} -e
${def.preStart}
''}
''}
${optionalString (def.script != "") ''
ExecStart=${pkgs.writeScript "${name}.sh" ''
ExecStart=${makeJobScript "${name}.sh" ''
#! ${pkgs.stdenv.shell} -e
${def.script}
''}

View File

@ -12,6 +12,8 @@ let
groupExists = g:
(g == "") || any (gg: gg.name == g) (attrValues config.users.extraGroups);
makeJobScript = name: content: "${pkgs.writeScriptBin name content}/bin/${name}";
# From a job description, generate an systemd unit file.
makeUnit = job:
@ -20,13 +22,13 @@ let
env = config.system.upstartEnvironment // job.environment;
preStartScript = pkgs.writeScript "${job.name}-pre-start.sh"
preStartScript = makeJobScript "${job.name}-pre-start.sh"
''
#! ${pkgs.stdenv.shell} -e
${job.preStart}
'';
startScript = pkgs.writeScript "${job.name}-start.sh"
startScript = makeJobScript "${job.name}-start.sh"
''
#! ${pkgs.stdenv.shell} -e
${if job.script != "" then job.script else ''
@ -34,19 +36,19 @@ let
''}
'';
postStartScript = pkgs.writeScript "${job.name}-post-start.sh"
postStartScript = makeJobScript "${job.name}-post-start.sh"
''
#! ${pkgs.stdenv.shell} -e
${job.postStart}
'';
preStopScript = pkgs.writeScript "${job.name}-pre-stop.sh"
preStopScript = makeJobScript "${job.name}-pre-stop.sh"
''
#! ${pkgs.stdenv.shell} -e
${job.preStop}
'';
postStopScript = pkgs.writeScript "${job.name}-post-stop.sh"
postStopScript = makeJobScript "${job.name}-post-stop.sh"
''
#! ${pkgs.stdenv.shell} -e
${job.postStop}