File: rc-debian.sh.in

package info (click to toggle)
milter-greylist 3.0-3.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 920 kB
  • ctags: 787
  • sloc: ansic: 6,864; sh: 3,205; yacc: 736; lex: 321; makefile: 166
file content (94 lines) | stat: -rw-r--r-- 2,134 bytes parent folder | download
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
#! /bin/sh

# Greylist init script
# July 2004
# BERTRAND Jo´┐Żl
#
### BEGIN INIT INFO
# Provides:    	     milter-greylist
# Required-Start:    $local_fs $named $remote_fs $syslog
# Required-Stop:     mountall
# Should-Start:	     sendmail
# Should-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Script to start/stop the greylist-milter
# Description: another spam-defense service
### END INIT INFO


# Based on skeleton by Miquel van Smoorenburg and Ian Murdock

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
DAEMON=@SBINDIR@/milter-greylist
NAME=greylist
SNAME=greylist
DESC="Greylist Mail Filter Daemon"
PIDFILE="/var/run/$NAME.pid"
PNAME="milter-greylist"
USER="@USER@"
SOCKET=/var/run/milter-greylist/milter-greylist.sock
DOPTIONS="-P $PIDFILE -u $USER -p $SOCKET"


[ -x $DAEMON ] || DAEMON=@BINDIR@/milter-greylist
[ -x $DAEMON ] || exit 0


export TMPDIR=/tmp
# Apparently people have trouble if this isn't explicitly set...

ENABLED=0
OPTIONS=""
NICE=

test -f /etc/default/milter-greylist && . /etc/default/milter-greylist

if [ "$ENABLED" = "0" ]; then
    echo "$DESC: disabled, see /etc/default/milter-greylist"
    exit 0
fi

if ! getent passwd | grep -q "^greylist:"; then
  echo "$0: greylist user does not exist. Aborting" >&2
  exit 1
fi
if ! getent group | grep -q "^greylist:" ; then
  echo "$0: greylist group does not exist. Aborting" >&2
  exit 1
fi

set -e

case "$1" in
  start)
	echo -n "Starting $DESC: "
	start-stop-daemon --start --pidfile $PIDFILE --name $PNAME \
	    $NICE --oknodo --startas $DAEMON -- $OPTIONS $DOPTIONS
	echo "$NAME."
	;;

  stop)
	echo -n "Stopping $DESC: "
	start-stop-daemon --stop --pidfile $PIDFILE --name $PNAME --oknodo
	echo "$NAME."
	;;

  restart|force-reload)
	echo -n "Restarting $DESC: "
	start-stop-daemon --stop --pidfile $PIDFILE --name $PNAME \
	    --retry 5 --oknodo
	start-stop-daemon --start --pidfile $PIDFILE --name $PNAME \
	    $NICE --oknodo --startas $DAEMON -- $OPTIONS $DOPTIONS

	echo "$NAME."
	;;

  *)
	N=/etc/init.d/$SNAME
	echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	exit 1
	;;
esac

exit 0