-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmilter-regex.init
115 lines (102 loc) · 2.31 KB
/
milter-regex.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/sh
# $Id: milter-regex.init,v 1.1.1.1 2007/01/11 15:49:52 dhartmei Exp $
# init file for milter-regex
# modified by Jim Klimov from init file for milter-greylist, (C) Mar 2005
#
# chkconfig: - 50 50
# description: Milter Regex Daemon
#
# processname: /usr/bin/milter-regex
# config: /etc/mail/milter-regex.conf
# pidfile: /var/milter-regex/milter-regex.pid
# source function library
. /etc/init.d/functions
configfile="/etc/mail/milter-regex.conf"
basedir="/var/milter-regex"
# pidfile="$basedir/milter-regex.pid"
socket="$basedir/milter-regex.sock"
user="mailregx"
OPTIONS="-c $configfile -u $user -p $socket"
# Enable testing only for users specified in config file
# OPTIONS="-T $OPTIONS"
# No idea what we could put here... paths like above? ;)
if [ -f /etc/sysconfig/milter-regex ]
then
. /etc/sysconfig/milter-regex
fi
RETVAL=0
prog="Milter-Regex"
start() {
echo -n $"Starting $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
if [ x"$basedir" != x -a x"$basedir" != x/ ]; then
if [ ! -d "$basedir" ]; then
echo -n "mkdir '$basedir': "
mkdir -p "$basedir"
chown "$user" "$basedir"
chgrp "$user" "$basedir"
fi
fi
if status milter-regex > /dev/null; then
echo -n "Already running!"
RETVAL=0
failure
else
if [ -S "$socket" ]; then
echo -n "clean stale socket: "
rm -f "$socket"
fi
daemon /usr/bin/milter-regex $OPTIONS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/milter-regex
fi
fi;
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
killproc /usr/bin/milter-regex
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/milter-regex
fi;
echo
return $RETVAL
}
restart(){
stop
start
}
condrestart(){
[ -e /var/lock/subsys/milter-regex ] && restart
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condrestart)
condrestart
;;
status)
status milter-regex
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
RETVAL=1
esac
exit $RETVAL