]> git.pld-linux.org Git - packages/postgrey.git/blob - postgrey.init
81175d71cbb92588894fdebfa024de85589d4981
[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                 /usr/sbin/postgrey -d --pidfile=/var/run/postgrey.pid $OPTIONS
44                 RETVAL=$?
45                 if [ $RETVAL -eq 0 ]; then
46                         ok
47                         touch /var/lock/subsys/postgrey
48                 else
49                         fail
50                 fi
51         else
52                 msg_already_running postgrey
53         fi
54         ;;
55   stop)
56         if [ -f /var/lock/subsys/postgrey ]; then
57                 msg_stopping postgrey
58                 killproc postgrey
59         else
60                 msg_not_running postgrey
61         fi
62         rm -f /var/lock/subsys/postgrey >/dev/null 2>&1
63         ;;
64   restart)
65         $0 stop
66         $0 start
67         exit $?
68         ;;
69   reload|force-reload)
70         if [ -f /var/lock/subsys/postgrey ]; then
71                 msg_reloading postgrey
72                 killproc postgrey -HUP
73                 RETVAL=$?
74         else
75                 msg_not_running postgrey
76                 exit 7
77         fi
78         ;;
79   status)
80         status --pidfile /var/run/postgrey.pid postgrey
81         exit $?
82         ;;
83   *)
84         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
85         exit 3
86 esac
87
88 exit $RETVAL
This page took 0.09292 seconds and 2 git commands to generate.