1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD$
#
# Start script for 'spamd' installed by the pkgsrc package collection
# running on *BSD, MacOS X, Solaris, Linux, and various other U*IX-like
# systems.
#
# The 'spamd' daemon checks emails provided by the 'spamc' client for signs
# of spam
#
# PLEASE read the file
# @PREFIX@/share/doc/spamassassin/spamd/README
# especially the section about security.
## only for DragonFlyBSD/NetBSD
# PROVIDE: spamd
# REQUIRE: LOGIN
# BEFORE: mail
# KEYWORD: shutdown
##
PATH=/sbin:/bin:/usr/sbin:/usr/bin:@PREFIX@/bin
export PATH
if [ -f /etc/rc.subr ]
then
. /etc/rc.subr
fi
name="spamd"
rcvar=$name
command_interpreter="@PERL5@"
command="@PREFIX@/bin/spamd"
pidfile="/var/run/${name}.pid"
sig_stop="TERM"
command_args="-d -r ${pidfile}"
extra_commands="reload"
sig_reload="HUP"
# default values, may be overridden on NetBSD/DragonFlyBSD by setting them
# in /etc/rc.conf
spamd_flags=${spamd_flags-"-H -c"}
spamd=${spamd:-NO}
spamd_fdlimit=${spamd_fdlimit-"128"}
# both set during package build
OPSYS=@OPSYS@
INTERPRETER_SUPPORT=@INTERPRETER_SUPPORT@
# A default limit of 64 on NetBSD may be too low for many
# people (e.g. with additional RBL rules)
SOFT_FDLIMIT=`ulimit -S -n`
HARD_FDLIMIT=`ulimit -H -n`
if [ ${spamd_fdlimit} -gt ${SOFT_FDLIMIT} ]; then
if [ ${spamd_fdlimit} -le ${HARD_FDLIMIT} ]; then
ulimit -S -n ${spamd_fdlimit}
else
ulimit -S -n ${HARD_FDLIMIT}
fi
fi
spamd_start()
{
if [ -n "${the_spamd_pid}" ]; then
echo "${command} already running as pid ${the_spamd_pid}."
return 1
fi
echo "Starting spamd"
${command} ${spamd_flags} ${command_args}
}
spamd_stop()
{
if [ -z "${the_spamd_pid}" ]; then
echo "${command} not running? (check ${pidfile})."
return 1
fi
echo "Stopping spamd"
kill -${sig_stop} ${the_spamd_pid}
}
spamd_status()
{
if [ -z "${the_spamd_pid}" ]; then
echo "${command} is not running? (check ${pidfile})."
else
echo "${command} is running as pid ${the_spamd_pid}."
fi
}
spamd_reload()
{
if [ -z "${the_spamd_pid}" ]; then
echo "${command} not running? (check ${pidfile})."
return 1
fi
echo "Reloading spamd"
kill -${sig_reload} ${the_spamd_pid}
}
if [ "${OPSYS}" = "NetBSD" -o "${OPSYS}" = "DragonFly" ]; then
if checkyesno INTERPRETER_SUPPORT; then
: # support for 'command_interpreter' was added in NetBSD 1.6
else
start_cmd="spamd_start"
stop_cmd="spamd_stop"
status_cmd="spamd_status"
reload_cmd="spamd_reload"
the_spamd_pid=`check_pidfile ${pidfile} ${command_interpreter}`
fi
load_rc_config $name
run_rc_command "$1"
else # not NetBSD or DragonFlyBSD
if [ -f ${pidfile} ]; then
the_spamd_pid=`head -1 ${pidfile}`
else
the_spamd_pid=
fi
case ${1+"$@"} in
start)
spamd_start
;;
stop)
spamd_stop
;;
restart)
spamd_stop
sleep 1
spamd_start
;;
status)
spamd_status
;;
reload)
spamd_reload
;;
*)
echo "Usage: ${0} (start|stop|restart|status|reload)"
;;
esac
fi
|