From 4c9ff7f904dd29fb6fd3d29d1fa6ba1d0808a4e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Tue, 13 Apr 2010 22:47:34 +0000 Subject: [PATCH] Making postfix properly start on boot. We could not start on 'filesystems', because filesystems is written as an upstart task. Additionally, as upstart calls the postfix start/stop script and it does not act as a daemon, we write it as a preStart/postStop job. Then we don't have monitoring or respawn, but at least upstart does not get confused on its state. svn path=/nixos/trunk/; revision=21061 --- modules/services/mail/postfix.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/services/mail/postfix.nix b/modules/services/mail/postfix.nix index 93596028678..939260632c9 100644 --- a/modules/services/mail/postfix.nix +++ b/modules/services/mail/postfix.nix @@ -283,11 +283,13 @@ in # accurate way is unlikely to be better. { description = "Postfix mail server"; - startOn = "started ${startingDependency} and filesystems"; + startOn = "started ${startingDependency}"; - daemonType = "fork"; + daemonType = "none"; - script = + respawn = false; + + preStart = '' if ! [ -d /var/spool/postfix ]; then ${pkgs.coreutils}/bin/mkdir -p /var/spool/mail /var/postfix/conf /var/postfix/queue @@ -309,6 +311,10 @@ in exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf start ''; # */ + preStop = '' + exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf stop + ''; + }; };