diff --git a/spampd.init b/spampd.init index 178d088..26f2103 100755 --- a/spampd.init +++ b/spampd.init @@ -1,44 +1,56 @@ #!/bin/sh # -# This script starts and stops the spampd daemon +# spampd Transparent SMTP/LMTP proxy filter using spamassassin # -# chkconfig: - 79 31 -# -# description: spampd uses SpamAssassin to check email messages for SPAM. +# chkconfig: - 79 31 +# description: Spampd is a program used within an e-mail delivery system to \ +# scan messages for possible Unsolicited Commercial E-mail (UCE, \ +# aka spam) content. It uses SpamAssassin (SA) to do the actual \ +# message scanning. + +### BEGIN INIT INFO +# Provides: spampd +# Required-Start: $local_fs $network +# Required-Stop: $local_fs $network +# Should-Start: +# Should-Stop: +# Default-Start: +# Default-Stop: 0 1 2 3 4 5 6 +# Short-Description: Transparent SMTP/LMTP proxy filter using spamassassin +# Description: Spampd is a program used within an e-mail delivery system +# to scan messages for possible Unsolicited Commercial +# E-mail (UCE, aka spam) content. It uses SpamAssassin (SA) +# to do the actual message scanning. +### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions -# Source networking configuration. -. /etc/sysconfig/network - -# Check that networking is up. -[ "${NETWORKING}" = "no" ] && exit 0 - +exec="/usr/sbin/spampd" prog="spampd" -OPTIONS="--user=spampd --group=spampd --tagall --local-only" +options="--user=spampd --group=spampd --tagall --local-only" -# Source an auxiliary options file if we have one, and pick up OPTIONS, -if [ -r /etc/sysconfig/$prog ]; then - . /etc/sysconfig/$prog -fi +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog -RETVAL=0 +lockfile=/var/lock/subsys/$prog start() { + [ -x $exec ] || exit 5 echo -n $"Starting $prog: " - daemon $prog $OPTIONS - RETVAL=$? + daemon $exec $options + retval=$? echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog + [ $retval -eq 0 ] && touch $lockfile + return $retval } stop() { echo -n $"Stopping $prog: " killproc $prog - RETVAL=$? + retval=$? echo - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog + [ $retval -eq 0 ] && rm -f $lockfile + return $retval } restart() { @@ -46,27 +58,52 @@ restart() { start } -# See how we were called. +reload() { + restart +} + +force_reload() { + restart +} + +rh_status() { + status $prog +} + +rh_status_q() { + rh_status &>/dev/null +} + + case "$1" in start) - start - ;; + rh_status_q && exit 0 + $1 + ;; stop) - stop - ;; + rh_status_q || exit 0 + $1 + ;; restart) - restart - ;; - condrestart) - [ -f /var/lock/subsys/$prog ] && restart - ;; + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; status) - status $prog - ;; + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + restart + ;; *) - echo $"Usage: $0 {start|stop|restart|condrestart|status}" - exit 1 + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 2 esac - -exit $RETVAL +exit $? diff --git a/spampd.spec b/spampd.spec index 7219527..e627afe 100644 --- a/spampd.spec +++ b/spampd.spec @@ -1,13 +1,14 @@ Summary: Transparent SMTP/LMTP proxy filter using spamassassin Name: spampd Version: 2.30 -Release: 5 +Release: 6 License: GPLv2+ Group: System Environment/Daemons URL: http://www.worlddesign.com/index.cfm/rd/mta/spampd.htm Source0: http://www.worlddesign.com/Content/rd/mta/spampd/spampd-%{version}.tar.gz Source1: spampd.init BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +Requires(pre): /usr/sbin/useradd Requires(post): /sbin/chkconfig Requires(preun): /sbin/service, /sbin/chkconfig Requires(postun): /sbin/service @@ -82,7 +83,11 @@ fi %changelog -* Wed Feb 25 2009 Fedora Release Engineering - 2.30-5 +* Sun Apr 12 2009 Matthias Saou 2.30-6 +- Update init script to the new style. +- Add missing Requires(pre): /usr/sbin/useradd. + +* Wed Feb 25 2009 Fedora Release Engineering - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild * Mon Aug 6 2007 Matthias Saou 2.30-4