wok diff postgrey/stuff/etc/init.d/postgrey @ rev 1560

glibc: fix ld.so.conf path
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Oct 13 09:25:04 2008 +0000 (2008-10-13)
parents
children ce2d65bd0418
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/postgrey/stuff/etc/init.d/postgrey	Mon Oct 13 09:25:04 2008 +0000
     1.3 @@ -0,0 +1,68 @@
     1.4 +#!/bin/sh
     1.5 +# /etc/init.d/postgrey : Start, stop and restart Grey list server on SliTaz, at 
     1.6 +# boot time or with the command line.
     1.7 +#
     1.8 +# To start Grey list server at boot time, just put postgrey in the $RUN_DAEMONS
     1.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf
    1.10 +#
    1.11 +. /etc/init.d/rc.functions
    1.12 +. /etc/daemons.conf
    1.13 +
    1.14 +NAME=Postgrey
    1.15 +DESC="Grey list server"
    1.16 +DAEMON=/usr/bin/postgrey
    1.17 +OPTIONS=$POSTGREY_OPTIONS
    1.18 +PIDFILE=/var/run/postgrey.pid
    1.19 +[ -n "$OPTIONS" ] || OPTIONS="--pidfile=$PIDFILE -d --inet=127.0.0.1:60000 --user=postfix"
    1.20 +
    1.21 +case "$1" in
    1.22 +  start)
    1.23 +    if [ -f $PIDFILE ] ; then
    1.24 +      echo "$NAME already running."
    1.25 +      exit 1
    1.26 +    fi
    1.27 +    if ! grep -q ^smtpd_recipient_restrictions /etc/postfix/main.cf; then
    1.28 +      echo -n "Updating /etc/postfix/main.cf"
    1.29 +      cat >> /etc/postfix/main.cf <<EOF
    1.30 +
    1.31 +# Add by $0
    1.32 +smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination,
    1.33 +	check_policy_service inet:127.0.0.1:60000,
    1.34 +	permit
    1.35 +
    1.36 +EOF
    1.37 +      /etc/init.d/postfix reload
    1.38 +    fi
    1.39 +    echo -n "Starting $DESC: $NAME... "
    1.40 +    $DAEMON $OPTIONS
    1.41 +    status
    1.42 +    ;;
    1.43 +  stop)
    1.44 +    if [ ! -f $PIDFILE ] ; then
    1.45 +      echo "$NAME is not running."
    1.46 +      exit 1
    1.47 +    fi
    1.48 +    echo -n "Stopping $DESC: $NAME... "
    1.49 +    kill `cat $PIDFILE`
    1.50 +    status
    1.51 +    ;;
    1.52 +  restart)
    1.53 +    if [ ! -f $PIDFILE ] ; then
    1.54 +      echo "$NAME is not running."
    1.55 +      exit 1
    1.56 +    fi
    1.57 +    echo -n "Restarting $DESC: $NAME... "
    1.58 +    kill `cat $PIDFILE`
    1.59 +    sleep 2
    1.60 +    $DAEMON $OPTIONS
    1.61 +    status
    1.62 +    ;;
    1.63 +  *)
    1.64 +    echo ""
    1.65 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart|reload]"
    1.66 +    echo ""
    1.67 +    exit 1
    1.68 +    ;;
    1.69 +esac
    1.70 +
    1.71 +exit 0