packages: policyd/policyd.init - cosmetics

glen glen at pld-linux.org
Mon Jan 3 13:31:44 CET 2011


Author: glen                         Date: Mon Jan  3 12:31:44 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- cosmetics

---- Files affected:
packages/policyd:
   policyd.init (1.8 -> 1.9) 

---- Diffs:

================================================================
Index: packages/policyd/policyd.init
diff -u packages/policyd/policyd.init:1.8 packages/policyd/policyd.init:1.9
--- packages/policyd/policyd.init:1.8	Tue Dec 26 21:08:15 2006
+++ packages/policyd/policyd.init	Mon Jan  3 13:31:39 2011
@@ -25,7 +25,7 @@
 # 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 PolicyD
+		msg_network_down "PolicyD"
 		exit 1
 	fi
 else
@@ -34,25 +34,27 @@
 
 start() {
 	# Check if the service is already running?
-	if [ ! -f /var/lock/subsys/policyd ]; then
-		msg_starting PolicyD
-		daemon $SERVICE_RUN_NICE_LEVEL /usr/lib/policyd/policyd -c "${POLICYD_CONF}"
-		RETVAL=$?
-		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/policyd
-	else
-		msg_already_running PolicyD
+	if [ -f /var/lock/subsys/policyd ]; then
+		msg_already_running "PolicyD"
+		return
 	fi
+
+	msg_starting "PolicyD"
+	daemon $SERVICE_RUN_NICE_LEVEL /usr/lib/policyd/policyd -c "${POLICYD_CONF}"
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/policyd
 }
 
 stop() {
 	# Stop daemon.
-	if [ -f /var/lock/subsys/policyd ]; then
-		msg_stopping PolicyD
-		killproc policyd
-		rm -f /var/lock/subsys/policyd
-	else
-		msg_not_running PolicyD
+	if [ ! -f /var/lock/subsys/policyd ]; then
+		msg_not_running "PolicyD"
+		return
 	fi
+
+	msg_stopping "PolicyD"
+	killproc policyd
+	rm -f /var/lock/subsys/policyd
 }
 
 init() {
@@ -87,11 +89,26 @@
 EOF
 }
 
+cleanup() {
+	if [ -r /var/run/policyd.lck ]; then
+		echo "PolicyD cleanup process already running." 1>&2
+		RETVAL=1
+	elif [ ! -r "${POLICYD_CONF}" ]; then
+		echo "PolicyD configuration file not found: ${POLICYD_CONF}" 1>&2
+		RETVAL=1
+	else
+		touch /var/run/policyd.lck
+		/usr/lib/policyd/cleanup -c "${POLICYD_CONF}"
+		RETVAL=$?
+		rm -f /var/run/policyd.lck
+	fi
+}
+
 RETVAL=0
 # See how we were called.
 case "$1" in
   start)
-  	start
+	start
 	;;
   stop)
   	stop
@@ -100,26 +117,15 @@
 	stop
 	start
 	;;
-  status)
-	status policyd
-	exit $?
-	;;
   cleanup|cron)
-	if [ -r /var/run/policyd.lck ]; then
-		echo "PolicyD cleanup process already running." 1>&2
-		RETVAL=1
-	elif [ ! -r "${POLICYD_CONF}" ]; then
-		echo "PolicyD configuration file not found: ${POLICYD_CONF}" 1>&2
-		RETVAL=1
-	else
-		touch /var/run/policyd.lck
-		/usr/lib/policyd/cleanup -c "${POLICYD_CONF}"
-		RETVAL=$?
-		rm -f /var/run/policyd.lck
-	fi
+	cleanup
 	;;
   init)
   	init
+	;;
+  status)
+	status policyd
+	exit $?
 	;;
   *)
 	msg_usage "$0 {start|stop|restart|force-reload|cron|init|status}"
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/policyd/policyd.init?r1=1.8&r2=1.9&f=u



More information about the pld-cvs-commit mailing list