wok view postgrey/stuff/etc/init.d/postgrey @ rev 22649

updated djview (4.10.3 -> 4.10.6)
author Hans-G?nter Theisgen
date Tue Jan 14 13:39:45 2020 +0100 (2020-01-14)
parents ce2d65bd0418
children
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="$(_ 'Postfix Greylisting Policy 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 _ '%s is already running.' $NAME
22 exit 1
23 fi
24 if ! grep -q ^smtpd_recipient_restrictions /etc/postfix/main.cf; then
25 _ 'Updating %s' '/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 action 'Starting %s: %s...' "$DESC" $NAME
37 $DAEMON $OPTIONS
38 status
39 ;;
40 stop)
41 if ! active_pidfile $PIDFILE postgrey ; then
42 _ '%s is not running.' $NAME
43 exit 1
44 fi
45 action 'Stopping %s: %s...' "$DESC" $NAME
46 kill $(cat $PIDFILE)
47 status
48 ;;
49 restart)
50 if ! active_pidfile $PIDFILE postgrey ; then
51 _ '%s is not running.' $NAME
52 exit 1
53 fi
54 action 'Restarting %s: %s...' "$DESC" $NAME
55 kill $(cat $PIDFILE)
56 sleep 2
57 $DAEMON $OPTIONS
58 status
59 ;;
60 *)
61 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
62 newline
63 exit 1
64 ;;
65 esac
67 exit 0