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