Author: viric Date: 2010-06-11 21:44:06 +0000 (Fri, 11 Jun 2010) New Revision: 22225
You can view the changes in this commit at: https://svn.nixos.org/viewvc/nix?rev=22225&view=rev Modified: nixos/trunk/modules/services/mail/postfix.nix nixos/trunk/modules/system/upstart/upstart.nix Log: 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. Changes: Modified: nixos/trunk/modules/services/mail/postfix.nix =================================================================== --- nixos/trunk/modules/services/mail/postfix.nix 2010-06-11 10:38:57 UTC (rev 22224) +++ nixos/trunk/modules/services/mail/postfix.nix 2010-06-11 21:44:06 UTC (rev 22225) @@ -287,8 +287,16 @@ 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 = '' if ! [ -d /var/spool/postfix ]; then Modified: nixos/trunk/modules/system/upstart/upstart.nix =================================================================== --- nixos/trunk/modules/system/upstart/upstart.nix 2010-06-11 10:38:57 UTC (rev 22224) +++ nixos/trunk/modules/system/upstart/upstart.nix 2010-06-11 21:44:06 UTC (rev 22225) @@ -21,6 +21,7 @@ makeJob = job: let + hasMain = job.script != "" || job.exec != ""; jobText = let log = "/var/log/upstart/${job.name}"; in @@ -77,12 +78,14 @@ ${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 _______________________________________________ nix-commits mailing list [email protected] http://mail.cs.uu.nl/mailman/listinfo/nix-commits
