-
Notifications
You must be signed in to change notification settings - Fork 4
/
vrfydmn.init
executable file
·60 lines (53 loc) · 1.28 KB
/
vrfydmn.init
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
#! /bin/bash
### BEGIN INIT INFO
# Provides: vrfydmn
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start vrfydmn daemon
# Description: Start up vrfydmn, a anti-spoofing milter for Postfix
### END INIT INFO
. /lib/lsb/init-functions
NAME=vrfydmn
COMMAND="/usr/local/sbin/${NAME}"
PIDFILE="/var/run/vrfydmn/vrfydmn.pid"
start_daemon() {
mkdir -p /var/run/${NAME}
chown milter:milter /var/run/${NAME}
echo "Starting ${NAME}"
start-stop-daemon --start --pidfile "${PIDFILE}" \
--exec ${COMMAND} -- -p "${PIDFILE}" -f /etc/postfix/relay_domains
return $?
}
stop_daemon() {
echo "Stopping ${NAME}"
killproc -p ${PIDFILE} ${COMMAND}
return $?
}
case "$1" in
start)
start_daemon
exit $?
;;
stop)
stop_daemon
exit $?
;;
restart)
$0 stop && $0 start
;;
reload)
echo "${NAME}: Reloading Postfix domain maps"
kill -SIGHUP $(cat ${PIDFILE})
;;
status)
status_of_proc -p ${PIDFILE} vrfydmn vrfydmn && exit 0 || exit $?
;;
*)
echo "Usage: ${NAME} {start|stop|restart|reload|status}" >&2
;;
esac
exit 0