blob: e4cb4a82f2bd07c165becc481af97869494e115e (
plain)
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
|
#!/bin/sh
# PROVIDE: postfwd
# REQUIRE: LOGIN cleanvar
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# postfwd_enable (bool):
# Set to "NO" by default.
# Set it to "YES" to enable postfwd.
# postfwd_config (path):
# Set to %%PREFIX%%/etc/postfwd.conf
# by default.
. /etc/rc.subr
name=postfwd
rcvar=postfwd_enable
load_rc_config $name
: ${postfwd_enable:="NO"}
: ${postfwd_flags="--shortlog --summary=600 --cache=600 --cache-rbl-timeout=3600 --cleanup-requests=1200 --cleanup-rbls=1800 --cleanup-rates=1200"}
pidfile=${postfwd_pidfile:="/var/run/${name}.pid"}
required_files=${postfwd_config:="%%PREFIX%%/etc/${name}.conf"}
command=%%PREFIX%%/bin/${name}
command_args="--daemon --file=${required_files} --pidfile=${pidfile} --interface=127.0.0.1 --port=10040 --user=nobody --group=nobody"
start_precmd="${name}_check"
status_cmd="${name}_status"
stop_cmd="${command} -k --pidfile=${pidfile}"
stop_postcmd="rm -f ${pidfile}"
extra_commands="reload"
reload_cmd="${name}_reload"
postfwd_check() {
if [ -f "${postfwd_pidfile}" ]; then
err 1 "${name} is already running."
fi
}
postfwd_status() {
postfwd_pid=`cat ${pidfile} 2>/dev/null`
postfwd_run=`ps -U nobody | grep -m 1 ${postfwd_pid} 2>/dev/null`
if [ -n "${postfwd_pid}" -a -n "${postfwd_run}" ]; then
echo "$name is running as ${postfwd_pid}"
else
echo "$name is not running"
fi
}
postfwd_reload() {
kill -HUP `cat $pidfile`
}
run_rc_command "$1"
|