freebsd-ports/mail/spampd/files/spampd.in
Doug Barton 0175383f0a Fix a few "bad example" problems in the rc.d scripts that have been
propogated by copy and paste.

1. Primarily the "empty variable" default assignment, which is mostly
${name}_flags="", but fix a few others as well.
2. Where they are not already documented, add the existence of the _flags
(or other deleted empties) option to the comments, and in some cases add
comments from scratch.
3. Replace things that look like:
prefix=%%PREFIX%%
command=${prefix}/sbin/foo
to just use %%PREFIX%%. In many cases the $prefix variable is only used
once, and in some cases it is not used at all.
4. In a few cases remove ${name}_flags from command_args
5. Remove a long-stale comment about putting the port's rc.d script in
/etc/rc.d (which is no longer necessary).

No PORTREVISION bumps because all of these changes are noops.
2009-07-15 16:56:10 +00:00

50 lines
940 B
Bash

#!/bin/sh
#
# PROVIDE: spampd
# REQUIRE: LOGIN
# BEFORE: mail
# KEYWORD: shutdown
#
# Add the fellowing line to /etc/rc.conf to enable spampd:
#
# spampd_enable (bool): Set it to "YES" to enable spampd
# Default is "NO"
# spampd_flags
. %%RC_SUBR%%
name="spampd"
rcvar=`set_rcvar`
: ${spampd_enable="NO"}
: ${spampd_pidfile="/var/run/spamd/spampd.pid"}
: ${spampd_flags="--user=spamd --group=spamd --host 127.0.0.1:10024 --relayhost=127.0.0.1:10025 --dose --tagall --auto-whitelist"}
load_rc_config $name
command="%%PREFIX%%/sbin/$name"
command_args="--pid=${spampd_pidfile}"
pidfile="${spampd_pidfile}"
sig_stop="-KILL"
stop_cmd="stop_cmd"
status_cmd="status_cmd"
stop_cmd()
{
if [ -f "$pidfile" ]; then
kill `cat $pidfile`
rm -f $pidfile
echo -n " spampd"
fi
}
status_cmd()
{
if [ -f "$pidfile" ]; then
echo "${name} is running as pid `cat $pidfile`."
else
echo "${name} is not running."
fi
}
run_rc_command $1