On Oct 13, 2008, at 5:01 AM, Rupert Reid wrote:

I am trying to setup postfix so that it will start automatically at startup. I placed the following script "postfix" in a text file "postfix" and saved it to Library/Startupitems/Postfix. As you probably guessed it did not work. I would be grateful for some detailed instructions on how I can get postfix to start automatically.

Sounds like you are missing the StartupParameters.plist file if you have only created the one file. Here are the two files I'm using:

StartupParameters.plist :


{
  Description   = "Postfix mail server";
  Provides      = ("SMTP");
  Requires      = ("Resolver", "policyd");
  Uses          = ("Network Time", "NFS");
  Preference    = "None";
  Messages =
  {
    start = "Starting Postfix";
    stop  = "Stopping Postfix";
    restart  = "Reloading Postfix Configuration";
  };
}


postfix:


#!/bin/sh

. /etc/rc.common

StartService ()
{
    if [ "${MAILSERVER:=-NO-}" = "-YES-" ]; then
            ConsoleMessage "Starting mail services"
            /usr/sbin/postfix start
    elif [ "${MAILSERVER:=-NO-}" = "-AUTOMATIC-" ]; then
            /usr/sbin/postfix-watch
    fi
}

StopService ()
{
        ConsoleMessage "Stopping Postfix mail services"
        /usr/sbin/postfix stop
        killall -1 postfix-watch 2> /dev/null
}

RestartService ()
{
    if [ "${MAILSERVER:=-NO-}" = "-YES-" ]; then
        ConsoleMessage "Reloading Postfix configuration"
        /usr/sbin/postfix reload
    else
        StopService
    fi
}

RunService "$1"


Files and the enclosing folder should be owned by root, privs should be 755 for the files and their enclosing folder.

Reply via email to