]> git.pld-linux.org Git - packages/postgrey.git/blame - postgrey.init
restored daemon() invocation
[packages/postgrey.git] / postgrey.init
CommitLineData
ca9d42a7
PG
1#!/bin/sh
2#
3949ad5d 3# postgrey Postfix Greylisting Policy Server
ca9d42a7 4#
3949ad5d
TP
5# chkconfig: 2345 79 31
6# description: Postfix Greylisting Policy Server
ca9d42a7 7#
3949ad5d 8# processname: postgrey
e8e7d086 9# pidfile: /var/run/postgrey.pid
ca9d42a7
PG
10#
11
3949ad5d 12# Source function library
ca9d42a7
PG
13. /etc/rc.d/init.d/functions
14
3949ad5d 15# Get network config
ca9d42a7
PG
16. /etc/sysconfig/network
17
3949ad5d 18OPTIONS="--unix=/var/spool/postfix/postgrey/socket"
ca9d42a7 19
3949ad5d
TP
20# Get service config
21[ -f /etc/sysconfig/postgrey ] && . /etc/sysconfig/postgrey
ca9d42a7 22
6fc9f9ce 23OPTIONS="$OPTIONS $POSTGREY_OPTS"
24
3949ad5d
TP
25# Check that networking is up.
26if 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
31else
32 exit 0
ca9d42a7
PG
33fi
34
ca9d42a7
PG
35RETVAL=0
36
ca9d42a7
PG
37# See how we were called.
38case "$1" in
39 start)
3949ad5d
TP
40 # Check if the service is already running?
41 if [ ! -f /var/lock/subsys/postgrey ]; then
42 msg_starting postgrey
51133ff8 43 daemon /usr/sbin/postgrey -d --pidfile=/var/run/postgrey.pid $OPTIONS
3949ad5d 44 RETVAL=$?
51133ff8 45 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/postgrey
3949ad5d
TP
46 else
47 msg_already_running postgrey
48 fi
ca9d42a7
PG
49 ;;
50 stop)
3949ad5d
TP
51 if [ -f /var/lock/subsys/postgrey ]; then
52 msg_stopping postgrey
53 killproc postgrey
3949ad5d
TP
54 else
55 msg_not_running postgrey
56 fi
e8e7d086 57 rm -f /var/lock/subsys/postgrey >/dev/null 2>&1
ca9d42a7
PG
58 ;;
59 restart)
3949ad5d
TP
60 $0 stop
61 $0 start
62 exit $?
ca9d42a7 63 ;;
3949ad5d
TP
64 reload|force-reload)
65 if [ -f /var/lock/subsys/postgrey ]; then
66 msg_reloading postgrey
67 killproc postgrey -HUP
68 RETVAL=$?
69 else
c4c67689 70 msg_not_running postgrey
3949ad5d
TP
71 exit 7
72 fi
ca9d42a7
PG
73 ;;
74 status)
e6ff7208 75 status --pidfile /var/run/postgrey.pid postgrey
3949ad5d 76 exit $?
ca9d42a7
PG
77 ;;
78 *)
3949ad5d
TP
79 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
80 exit 3
ca9d42a7
PG
81esac
82
3949ad5d 83exit $RETVAL
This page took 0.066646 seconds and 4 git commands to generate.