apricoti

 

SpamAssassinStartupItem

Page history last edited by Anonymous 2 yrs ago


 

Here's a Mac OS X StartupItem for spamd (part of SpamAssassin)

 

I packaged the files with an installer for an easy experience, but you can also browse them here before downloading.

The installer places the files in /System/Library/StartupItems/spamd (creates it if it does not already exist).

The installer will warn you if you already have a spamd startupitem.

 

To test that it's working, follow this script:

 

sudo /System/Library/StartupItems/spamd/spamd start ; ps -gauxww | grep spamd
sudo /System/Library/StartupItems/spamd/spamd stop ; ps -gauxww | grep spamd
sudo /System/Library/StartupItems/spamd/spamd restart ; ps -gauxww | grep spamd

 

Download the installer

 

http://www.buhacoff.net/2005/projects/spamd-startupitem/spamd-startupitem.pkg.zip

 

View the source

 

spamd

 

#!/bin/sh
# spamd StartupItem for Mac OS X
# Copyright (C) 2005 Jonathan Buhacoff <jonathan@pnc.net>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
. /etc/rc.common
StartService ()
{
echo "Starting spamd"
/usr/bin/spamd -q -x -r /var/run/spamd.pid -d
}
StopService ()
{
if [ -f /var/run/spamd.pid ] ; then
SPAMDPID=`cat /var/run/spamd.pid`
if [ "x$SPAMDPID" = "x" ] ; then
echo "Cannot find spamd"
rm /var/run/spamd.pid
return
fi
echo "Stopping spamd"
kill $SPAMDPID
else
echo "Searching for spamd"
ps gauxww | grep spamd | grep -v grep | awk '{ print $2 }' | grep -v $$ | sort | head -n 1 > /var/run/spamd.pid
StopService
fi
}
RestartService ()
{
StopService
sleep 1
StartService
}
RunService "$1"

 

StartupParameters.plist

 

{
Description     = "spamd message scanning service";
Provides        = ("spamd");
}

Comments (0)

You don't have permission to comment on this page.