File: rc-gentoo.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 (44 lines) | stat: -rw-r--r-- 1,093 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
#!/sbin/runscript
# $Header: /cvsroot/milter-greylist/rc-gentoo.sh.in,v 1.1 2004/11/28 17:40:13 manu Exp $Id 

# NB: Gentoo Config is in /etc/conf.d/milter-greylist

opts="start stop restart status"

# For a true ebuild the following variables should be put in 
#/etc/conf.d/milter-greylist
NAME=milter-greylist
DAEMON=/usr/local/bin/$NAME
USER=@USER@
# SOCKET should be the socket specified  in the MILTER definition sendmail.mc 
# INPUT_MAIL_FILTER(`greylist',`S=local:/var/milter-greylist/milter-greylist.sock')
SOCKET=/var/$NAME/milter-greylist.sock
PIDFILE="/var/$NAME/$NAME.pid"
DOPTIONS="-p $SOCKET -u $USER -P $PIDFILE"

depend() {
	need net 
	use logger
	before sendmail
}

start() {
	ebegin "Starting $DESC"
	start-stop-daemon --quiet --start --startas $DAEMON --pidfile $PIDFILE  -- $DOPTIONS
	eend $? "Failed to start ${DAEMON}"
}

stop() {
	ebegin "Stopping $DESC"
	start-stop-daemon --stop --name $NAME
	eend $? "Failed to stop ${DAEMON}"
}

restart() {
	svc_stop 
	# needed to avoid potential mi_stop errors 
	sleep 4
	svc_start
	kill -HUP `head -n 1 /var/run/sendmail.pid` 
}