SOURCES: postgrey.init - PLDized

gotar gotar at pld-linux.org
Wed Nov 2 12:29:47 CET 2005


Author: gotar                        Date: Wed Nov  2 11:29:47 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- PLDized

---- Files affected:
SOURCES:
   postgrey.init (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: SOURCES/postgrey.init
diff -u SOURCES/postgrey.init:1.1 SOURCES/postgrey.init:1.2
--- SOURCES/postgrey.init:1.1	Mon Sep  5 14:57:38 2005
+++ SOURCES/postgrey.init	Wed Nov  2 12:29:42 2005
@@ -1,90 +1,81 @@
 #!/bin/sh
 #
+# postgrey	Postfix Greylisting Policy Server
 #
-# chkconfig: 2345 79 31
-# description: Postfix Greylisting Policy Server
+# chkconfig:	2345 79 31
+# description:	Postfix Greylisting Policy Server
 #
-# processname: postgrey
-# pidfile: /var/run/greylist.pid
+# processname:	postgrey
+# pidfile:	/var/run/greylist.pid
 #
 
-# Source function library.
+# Source function library
 . /etc/rc.d/init.d/functions
 
-# Source networking configuration.
+# Get network config
 . /etc/sysconfig/network
 
-# Check that networking is up.
-[ ${NETWORKING} = "no" ] && exit 0
+OPTIONS="--unix=/var/spool/postfix/postgrey/socket"
 
-prog=postgrey
-postgrey=/usr/sbin/$prog
-DBPATH=/var/spool/postfix/postgrey
-SOCKET=$DBPATH/socket
-OPTIONS="--unix=$SOCKET"
-
-# Source an auxiliary options file if we have one, and pick up OPTIONS,
-if [ -r /etc/sysconfig/$prog ] ; then
-        . /etc/sysconfig/$prog
-fi
+# Get service config
+[ -f /etc/sysconfig/postgrey ] && . /etc/sysconfig/postgrey
 
-[ -x $postgrey ] || exit 0
-[ -d $DBPATH ] || exit 0
-#[ -f /etc/postfix/postgrey_whitelist_clients ] || exit 0
-#[ -f /etc/postfix/postgrey_whitelist_recipients ] || exit 0
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+	if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+		msg_network_down postgrey
+		exit 1
+	fi
+else
+	exit 0
+fi
 
 RETVAL=0
 
-start() {
-        echo -n $"Starting $prog: "
-        daemon $postgrey -d $OPTIONS
-        RETVAL=$?
-        echo
-        [ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
-        return $RETVAL
-}
-stop() {
-        echo -n $"Stopping $prog: "
-        killproc $postgrey
-        RETVAL=$?
-        echo
-        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog /var/run/$prog.pid
-}
-
-restart() {
-	stop
-	start
-}
-
-reload() {
-	echo -n $"Reloading $prog: "
-	killproc $prog -HUP
-	RETVAL=$?
-	echo
-	return $RETVAL
-}
- 
 # See how we were called.
 case "$1" in
   start)
-	start
+	# Check if the service is already running?
+	if [ ! -f /var/lock/subsys/postgrey ]; then
+		msg_starting postgrey
+		daemon postgrey -d $OPTIONS
+		RETVAL=$?
+		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/postgrey
+	else
+		msg_already_running postgrey
+	fi
 	;;
   stop)
-	stop
+	if [ -f /var/lock/subsys/postgrey ]; then
+		msg_stopping postgrey
+		killproc postgrey
+		rm -f /var/lock/subsys/postgrey >/dev/null 2>&1
+	else
+		msg_not_running postgrey
+	fi
 	;;
   restart)
-	stop
-	start
+	$0 stop
+	$0 start
+	exit $?
 	;;
-  reload)
-	reload
+  reload|force-reload)
+	if [ -f /var/lock/subsys/postgrey ]; then
+		msg_reloading postgrey
+		killproc postgrey -HUP
+		RETVAL=$?
+	else
+		msg_not_running postgrey >&2
+		exit 7
+	fi
 	;;
   status)
-  	status $prog
+	status postgrey
+	exit $?
 	;;
   *)
-	echo "Usage: $prog {start|stop|restart|reload|status}"
-	exit 1
+	msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+	exit 3
 esac
 
-exit $?
+exit $RETVAL
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/postgrey.init?r1=1.1&r2=1.2&f=u




More information about the pld-cvs-commit mailing list