83eb2c3700
literal name_enable wherever possible, and ${name}_enable when it's not, to prepare for the demise of set_rcvar(). In cases where I had to hand-edit unusual instances also modify formatting slightly to be more uniform (and in some cases, correct). This includes adding some $FreeBSD$ tags, and most importantly moving rcvar= to right after name= so it's clear that one is derived from the other.
50 lines
942 B
Bash
50 lines
942 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
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="spampd"
|
|
rcvar=spampd_enable
|
|
|
|
: ${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
|