]> TLD Linux GIT Repositories - packages/postgrey.git/blob - postgrey.init
- from PLD, migrated configuration to /etc/postfix
[packages/postgrey.git] / postgrey.init
1 #!/bin/sh
2 #
3 # postgrey      Postfix Greylisting Policy Server
4 #
5 # chkconfig:    2345 79 31
6 # description:  Postfix Greylisting Policy Server
7 #
8 # processname:  postgrey
9 # pidfile:      /var/run/postgrey.pid
10 #
11
12 # Source function library
13 . /etc/rc.d/init.d/functions
14
15 # Get network config
16 . /etc/sysconfig/network
17
18 OPTIONS="--unix=/var/spool/postfix/postgrey/socket"
19
20 # Get service config
21 [ -f /etc/sysconfig/postgrey ] && . /etc/sysconfig/postgrey
22
23 OPTIONS="$OPTIONS $POSTGREY_OPTS"
24
25 # Check that networking is up.
26 if is_yes "${NETWORKING}"; then
27         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
28                 msg_network_down postgrey
29                 exit 1
30         fi
31 else
32         exit 0
33 fi
34
35 RETVAL=0
36
37 # See how we were called.
38 case "$1" in
39   start)
40         # Check if the service is already running?
41         if [ ! -f /var/lock/subsys/postgrey ]; then
42                 msg_starting postgrey
43                 daemon /usr/sbin/postgrey -d --pidfile=/var/run/postgrey.pid $OPTIONS
44                 RETVAL=$?
45                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/postgrey
46         else
47                 msg_already_running postgrey
48         fi
49         ;;
50   stop)
51         if [ -f /var/lock/subsys/postgrey ]; then
52                 msg_stopping postgrey
53                 killproc postgrey
54         else
55                 msg_not_running postgrey
56         fi
57         rm -f /var/lock/subsys/postgrey >/dev/null 2>&1
58         ;;
59   restart)
60         $0 stop
61         $0 start
62         exit $?
63         ;;
64   reload|force-reload)
65         if [ -f /var/lock/subsys/postgrey ]; then
66                 msg_reloading postgrey
67                 killproc postgrey -HUP
68                 RETVAL=$?
69         else
70                 msg_not_running postgrey
71                 exit 7
72         fi
73         ;;
74   status)
75         status --pidfile /var/run/postgrey.pid postgrey
76         exit $?
77         ;;
78   *)
79         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
80         exit 3
81 esac
82
83 exit $RETVAL