blob: 6983bddaefe5d7cd2068714a7a78868502268791 (
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
|
#!/sbin/openrc-run
description="Rapid mail filter"
command=/usr/sbin/rmilter
command_args=${cfgfile:+"-c $cfgfile"}
: ${user:=rmilter}
: ${group:=rmilter}
: ${cfgfile:=/etc/rmilter/rmilter.conf}
pidfile=$(grep '^[[:space:]]*pidfile[[:space:]]*=' $cfgfile | sed 's/[[:space:];]//g' | cut -d= -f2)
required_files="$cfgfile"
extra_started_commands="reload"
description_reload="Reload configuration"
start_stop_daemon_args="$start_stop_daemon_args --user $user --group $group"
depend() {
need net localmount
use logger antivirus antispam
for file in $(ls /etc/conf.d/${RC_SVCNAME}-rc_need@* 2>/dev/null); do
need ${file#*@}
done
}
start_pre() {
ebegin
checkpath --directory --owner $user:$group ${pidfile%/*}
bind_socket=$(grep '^[[:space:]]*bind_socket[[:space:]]*=[[:space:]]*unix:' $cfgfile | sed 's/[[:space:];]//g' | cut -d: -f2)
diff_dir=$(grep -hr '^[[:space:]]*diff_dir[[:space:]]*=' ${cfgfile%/*} | sed 's/[[:space:];]//g' | cut -d= -f2)
if [ "$bind_socket" ]; then
checkpath --directory --owner $user:$group ${bind_socket%/*}
rm -f $bind_socket
fi
if [ "$diff_dir" ]; then
checkpath --directory --owner $user:$group $diff_dir
rm -f $diff_dir/*
fi
eend $?
}
reload() {
ebegin "Reloading ${RC_SVCNAME}"
start-stop-daemon --signal USR1 --pidfile $pidfile
eend $?
}
|