MailScanner on Mac OSX (10.4.6 Intel CoreDuo) - working!
Jim Dickenson
dickenson at cfmc.com
Tue Apr 11 14:49:37 IST 2006
Basically you create a directory under /Library/StartupItems. The
directories I have are owned by root:wheel and have permissions 755.
In this directory you create a script that starts the process. Here is an
example:
#!/bin/sh
##
# MySQL 4 Server
##
. /etc/rc.common
StartService ()
{
if [ "${MYSQL:=-NO-}" = "-YES-" ]; then
ConsoleMessage "Starting MySQL Server"
cd /Library/MySQL
./bin/mysqld_safe &
fi
}
StopService ()
{
ConsoleMessage "Stopping MySQL Server"
PIDS=`ps ax | grep mysql | grep -v grep | awk '{print $1}'`
for pid in $PIDS; do
kill -KILL $pid
done
}
RestartService ()
{
StopService
sleep 3
StartService
}
RunService "$1"
This file has the same name as the directory, although I do not know if that
is required it seems to be the case in the directories I have. The file is
owned by root:wheel and has permissions 755.
The line:
if [ "${MYSQL:=-NO-}" = "-YES-" ]; then
is used to evaluate a line in /etc/hostconifg that looks like "MYSQL=-YES-"
or " MYSQL=-NO-" and says if you want the process to start at reboot or not.
The second file is a properties list file named StartupParameters.plist with
owner root:wheel and permissions 644. Here is an example:
{
Description = "MySQL Server";
Provides = ("MySQL");
Requires = ("Resolver");
OrderPreference = "Late";
Messages =
{
start = "Starting MySQL Server";
stop = "Stopping MySQL Server";
};
}
User startup processes are controlled in /Library/StartupItems while system
processes are controlled in /System/Library/StartupItems.
--
Jim Dickenson
mailto:dickenson at cfmc.com
CfMC
http://www.cfmc.com/
> From: James Gray <james at grayonline.id.au>
> Organization: GrayOnline
> Reply-To: MailScanner discussion <mailscanner at lists.mailscanner.info>
> Date: Tue, 11 Apr 2006 15:22:31 +1000
> To: MailScanner List <mailscanner at lists.mailscanner.info>
> Subject: MailScanner on Mac OSX (10.4.6 Intel CoreDuo) - working!
>
> Hi All,
>
> Just thought I'd post my results after tinkering for the last few days.
>
> - Still haven't figured out OSX's launchd stuff to get it to fire up
> MailScanner automagically. (Anyone?)
More information about the MailScanner
mailing list