mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2025-01-08 06:28:50 +03:00
Fixing the postfix start/stop (through an upstart job script code that will
monitor the life of postfix) Adding an assert to upstart jobs, so those with preStop will always need an exec or script, otherwise the preStop will not be run. svn path=/nixos/trunk/; revision=22225
This commit is contained in:
parent
dadd6d63e7
commit
b25771532a
@ -287,7 +287,15 @@ in
|
||||
|
||||
daemonType = "none";
|
||||
|
||||
respawn = false;
|
||||
respawn = true;
|
||||
|
||||
script = ''
|
||||
while ${pkgs.procps}/bin/ps `${pkgs.coreutils}/bin/cat /var/postfix/queue/pid/master.pid` |
|
||||
grep -q postfix
|
||||
do
|
||||
${pkgs.coreutils}/bin/sleep 1m
|
||||
done
|
||||
'';
|
||||
|
||||
preStart =
|
||||
''
|
||||
|
@ -21,6 +21,7 @@ let
|
||||
makeJob = job:
|
||||
|
||||
let
|
||||
hasMain = job.script != "" || job.exec != "";
|
||||
|
||||
jobText =
|
||||
let log = "/var/log/upstart/${job.name}"; in
|
||||
@ -77,12 +78,14 @@ let
|
||||
${optionalString job.task "task"}
|
||||
${optionalString (!job.task && job.respawn) "respawn"}
|
||||
|
||||
${optionalString (job.preStop != "") ''
|
||||
${ # preStop is run only if there is exec or script.
|
||||
# (upstart 0.6.5, job.c:562)
|
||||
optionalString (job.preStop != "") (assert hasMain; ''
|
||||
pre-stop script
|
||||
exec >> ${log} 2>&1
|
||||
${job.preStop}
|
||||
end script
|
||||
''}
|
||||
'')}
|
||||
|
||||
${optionalString (job.postStop != "") ''
|
||||
post-stop script
|
||||
|
Loading…
Reference in New Issue
Block a user