postfix: convert service to systemd

This commit is contained in:
Peter Simons 2012-09-23 00:51:50 +02:00 committed by Eelco Dolstra
parent 5ef71c6d22
commit af7c192f2a

View File

@ -318,22 +318,13 @@ in
# accurate way is unlikely to be better.
{ description = "Postfix mail server";
startOn = "started networking and filesystem";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
daemonType = "none";
respawn = true;
daemonType = "fork";
environment.TZ = config.time.timeZone;
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
@ -346,7 +337,7 @@ 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
ln -sf "${pkgs.postfix}/share/postfix/conf/"* /var/postfix/conf
ln -sf ${aliasesFile} /var/postfix/conf/aliases
ln -sf ${virtualFile} /var/postfix/conf/virtual
@ -355,11 +346,11 @@ in
${pkgs.postfix}/sbin/postalias -c /var/postfix/conf /var/postfix/conf/aliases
${pkgs.postfix}/sbin/postmap -c /var/postfix/conf /var/postfix/conf/virtual
exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf start
''; # */
${pkgs.postfix}/sbin/postfix -c /var/postfix/conf start
'';
preStop = ''
exec ${pkgs.postfix}/sbin/postfix -c /var/postfix/conf stop
${pkgs.postfix}/sbin/postfix -c /var/postfix/conf stop
'';
};