File: init

package info (click to toggle)
greylistd 0.8.8
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 348 kB
  • sloc: python: 1,012; sh: 257; makefile: 43
file content (82 lines) | stat: -rwxr-xr-x 1,655 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
### BEGIN INIT INFO
# Provides:          greylist
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop the greylistd(8) daemon.
### END INIT INFO
########################################################################
### FILE:	/etc/init.d/greylist
########################################################################

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

# 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)
	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\"."
	    exit 1
	fi

	echo -n "Starting greylisting daemon: "
	start-stop-daemon --start --background \
	    --chuid "$user" \
	    --pidfile "$pidfile" --make-pidfile \
	    --exec "$daemon" &&
	    echo "${daemon##*/}."
	;;


    stop)
	echo -n "Stopping greylisting daemon: "
	start-stop-daemon --stop --pidfile "$pidfile" &&
	    rm -f "$pidfile" &&
	    echo "${daemon##*/}."
	;;


    reload|force-reload)
	"$client" reload
	;;

    status)
	"$client" stats
	;;


    restart)
	$0 stop
	sleep 1
	$0 start
	;;


    *)
	echo "Usage: $0 {start|stop|restart|reload|force-reload|status}" >&2
	exit 1
	;;
esac

exit 0