[Nix-dev] postfix fork fix

Marc Weber marco-oweber at gmx.de
Thu Aug 7 21:53:05 CEST 2008


Trouble:
initctl status shows postfix has stopped even when it's still running.
Patching postfix-script to not fork solves this issue.
Because I'm already running upstart-0.5 I'd like to paste the patch here
which might work for upstart-0.3 as well ?
Maybe someone wants to verify that the job still works?

Sincerly Marc Weber


diff --git a/upstart-jobs/postfix.nix b/upstart-jobs/postfix.nix
index ebc6f79..a956d86 100644
--- a/upstart-jobs/postfix.nix
+++ b/upstart-jobs/postfix.nix
@@ -133,6 +133,8 @@ in
     start on ${startingDependency}/started
     stop on never
 
+    env PATH=/var/run/current-system/sw/bin
+    # expect fork -> killed by TRAP, does'nt work
     script 
         if ! [ -d /var/spool/postfix ]; then
           ${pkgs.coreutils}/bin/mkdir -p /var/spool/mail
/var/postfix/conf /var/postfix/queue
@@ -144,7 +146,13 @@ in
        ${pkgs.coreutils}/bin/chown root.root /var/spool/mail
        ${pkgs.coreutils}/bin/chmod a+rwxt /var/spool/mail
         
-       ln -sf ${pkgs.postfix}/share/postfix/conf/* /var/postfix/conf
+        from=${pkgs.postfix}/share/postfix/conf
+        to=/var/postfix/conf
+       ln -sf $from/* $to
+        rm $to/postfix-script
+        cp {$from,$to}/postfix-script
+        # I'd like to use exec $daemon_directory/master but then the
master exits after some seconds.. (??)
+        sed 's=$daemon_directory/master &=$daemon_directory/master=' -i
$to/postfix-script # don't fork, use exec and never return
 
         ln -sf ${aliasesFile} /var/postfix/conf/aliases
         ln -sf ${mainCfFile} /var/postfix/conf/main.cf



More information about the nix-dev mailing list