wok-next view postgrey/stuff/etc/init.d/postgrey @ rev 11849
busybox, uclibc-cross-compiler-i486: update bdeps again....
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Feb 27 09:08:44 2012 +0100 (2012-02-27) |
parents | 16fdba95d583 |
children | 7f188676b59c |
line source
1 #!/bin/sh
2 # /etc/init.d/postgrey : Start, stop and restart Grey list server on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start Grey list server at boot time, just put postgrey in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=Postgrey
12 DESC="Grey list server"
13 DAEMON=/usr/bin/postgrey
14 OPTIONS=$POSTGREY_OPTIONS
15 PIDFILE=/var/run/postgrey.pid
16 [ -n "$OPTIONS" ] || OPTIONS="--pidfile=$PIDFILE -d --inet=127.0.0.1:60000 --user=postfix"
18 case "$1" in
19 start)
20 if active_pidfile $PIDFILE postgrey ; then
21 echo "$NAME already running."
22 exit 1
23 fi
24 if ! grep -q ^smtpd_recipient_restrictions /etc/postfix/main.cf; then
25 echo -n "Updating /etc/postfix/main.cf"
26 cat >> /etc/postfix/main.cf <<EOF
28 # Add by $0
29 smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination,
30 check_policy_service inet:127.0.0.1:60000,
31 permit
33 EOF
34 /etc/init.d/postfix reload
35 fi
36 echo -n "Starting $DESC: $NAME... "
37 $DAEMON $OPTIONS
38 status
39 ;;
40 stop)
41 if ! active_pidfile $PIDFILE postgrey ; then
42 echo "$NAME is not running."
43 exit 1
44 fi
45 echo -n "Stopping $DESC: $NAME... "
46 kill `cat $PIDFILE`
47 status
48 ;;
49 restart)
50 if ! active_pidfile $PIDFILE postgrey ; then
51 echo "$NAME is not running."
52 exit 1
53 fi
54 echo -n "Restarting $DESC: $NAME... "
55 kill `cat $PIDFILE`
56 sleep 2
57 $DAEMON $OPTIONS
58 status
59 ;;
60 *)
61 echo ""
62 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart|reload]"
63 echo ""
64 exit 1
65 ;;
66 esac
68 exit 0