3
0
Fork 0
forked from mirrors/nixpkgs

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
This commit is contained in:
Lluís Batlle i Rossell 2010-04-13 22:47:34 +00:00
parent 9cce36182d
commit 4c9ff7f904

View file

@ -283,11 +283,13 @@ in
# accurate way is unlikely to be better. # accurate way is unlikely to be better.
{ description = "Postfix mail server"; { 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 if ! [ -d /var/spool/postfix ]; then
${pkgs.coreutils}/bin/mkdir -p /var/spool/mail /var/postfix/conf /var/postfix/queue ${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 exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf start
''; # */ ''; # */
preStop = ''
exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf stop
'';
}; };
}; };