blob: 9cce8d995b404d5c14b2b98096f8792889644ed3 (
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#!/bin/bash
client=/usr/bin/greylist
daemon=/usr/sbin/greylistd
rundir=/var/run/greylistd
datadir=/var/lib/greylistd
pidfile=$rundir/pid
socket=$rundir/socket
user=greylist
group=greylist
. /etc/rc.conf
. /etc/rc.d/functions
# See if the daemon is present
test -x "$daemon" || exit 0
# Make sure /var/run/greylistd exists (/var/run may be a tmpfs)
test -d "$rundir" || {
mkdir -p "$rundir"
chown "$user:$group" "$rundir"
}
case "$1" in
start)
stat_busy "Starting Greylistd"
if [ -e "$socket" ]
then
echo "$0:"
echo " Another instance of \`${daemon##*/}' seems to be running."
echo " If this is not the case, please remove \"$socket\"."
stat_fail
exit 1
fi
if [ ! -e $rundir ]; then
mkdir $rundir
fi
chown $user:$group $rundir
chmod 755 $rundir
start-stop-daemon --start --background \
--chuid "$user" \
--pidfile "$pidfile" --make-pidfile \
--exec "$daemon"
add_daemon greylistd
stat_done
;;
stop)
stat_busy "Stopping Greylistd"
start-stop-daemon --stop --pidfile "$pidfile" &&
rm -f "$pidfile"
rm_daemon greylistd
stat_done
;;
reload|force-reload)
"$client" reload
;;
status)
"$client" stats
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload|status}" >&2
exit 1
;;
esac
exit 0
|