wok annotate postgrey/stuff/etc/init.d/postgrey @ rev 24988

Fix perl-gd & tcptrack
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu May 12 11:01:25 2022 +0000 (2022-05-12)
parents ce2d65bd0418
children
rev   line source
pascal@1211 1 #!/bin/sh
al@19159 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
al@19159 12 DESC="$(_ 'Postfix Greylisting Policy 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
al@19159 21 _ '%s is already running.' $NAME
pascal@1211 22 exit 1
pascal@1211 23 fi
pascal@1211 24 if ! grep -q ^smtpd_recipient_restrictions /etc/postfix/main.cf; then
al@19159 25 _ 'Updating %s' '/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
al@19159 36 action 'Starting %s: %s...' "$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
al@19159 42 _ '%s is not running.' $NAME
pascal@1211 43 exit 1
pascal@1211 44 fi
al@19159 45 action 'Stopping %s: %s...' "$DESC" $NAME
al@19159 46 kill $(cat $PIDFILE)
pascal@1211 47 status
pascal@1211 48 ;;
pascal@1211 49 restart)
pascal@3876 50 if ! active_pidfile $PIDFILE postgrey ; then
al@19159 51 _ '%s is not running.' $NAME
pascal@1211 52 exit 1
pascal@1211 53 fi
al@19159 54 action 'Restarting %s: %s...' "$DESC" $NAME
al@19159 55 kill $(cat $PIDFILE)
pascal@1211 56 sleep 2
pascal@1211 57 $DAEMON $OPTIONS
pascal@1211 58 status
pascal@1211 59 ;;
pascal@1211 60 *)
al@19159 61 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
al@19159 62 newline
pascal@1211 63 exit 1
pascal@1211 64 ;;
pascal@1211 65 esac
pascal@1211 66
pascal@1211 67 exit 0