aboutsummaryrefslogtreecommitdiffstats
path: root/mail/spampd/files/spampd.in
blob: 974d78a6c44bb1577ee2ee58b6d8dc37e498e726 (plain) (blame)
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
#!/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