We had a power outage here last night, and when the server rebooted,
dovecot was unable to launch properly:
8/27/09 2:08:25 AM com.apple.SystemStarter[31] Starting dovecot
8/27/09 2:08:25 AM com.apple.SystemStarter[31] Fatal: Dovecot is
already running with PID 143 (read from /usr/local/var/run/dovecot/
master.pid)
8/27/09 2:08:25 AM SystemStarter[31] dovecot (115) did not complete
successfully
When I checked the server and saw this, I simply started it via the
command line, and it came right up, but of course that was hours
later. Since this script is only called at startup, would it be safe
to just delete master.pid before trying to start dovecot?
The server here is OS X 10.5.7, dovecot is being called via a
StartupItem. I had originally used a LaunchDaemon for starting this,
but ran into issues because MySQL wasn't always ready when dovecot
tried to launch, and dovecot would never come up as a result. Below
is the script I'm using, which includes a check for MySQL:
#!/bin/sh
# A script to automatically start up policyd on system bootup
. /etc/rc.common
ConsoleMessage "dovecot - setting up"
# wait for mysql start up
IS_ALIVE=`/usr/local/mysql/bin/mysqladmin -umysql ping | grep -c
'alive'`
while [ "$IS_ALIVE" != "1" ];
do
sleep 5
ConsoleMessage "dovecot - waiting for MySQL"
IS_ALIVE=`/usr/local/mysql/bin/mysqladmin -umysql ping | grep -c
'alive'`
done
StartService ()
{
ConsoleMessage "Starting dovecot"
/usr/local/sbin/dovecot
}
StopService ()
{
return 0
}
RestartService ()
{
return 0
}
RunService "$1"