SOURCES: powernowd.init - add try-restart

glen glen at pld-linux.org
Sun Apr 27 02:42:13 CEST 2008


Author: glen                         Date: Sun Apr 27 00:42:13 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- add try-restart

---- Files affected:
SOURCES:
   powernowd.init (1.6 -> 1.7) 

---- Diffs:

================================================================
Index: SOURCES/powernowd.init
diff -u SOURCES/powernowd.init:1.6 SOURCES/powernowd.init:1.7
--- SOURCES/powernowd.init:1.6	Sun Apr 27 02:39:13 2008
+++ SOURCES/powernowd.init	Sun Apr 27 02:42:08 2008
@@ -65,16 +65,7 @@
 	fi
 }
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
-  	start
-	;;
-  stop)
-  	stop
-	;;
-  reload|force-reload)
+reload() {
 	if [ -f /var/lock/subsys/powernowd ]; then
 		msg_reloading powernowd
 		killproc powernowd -HUP
@@ -83,17 +74,43 @@
 		msg_not_running powernowd
 		exit 7
 	fi
+}
+
+condrestart() {
+	if [ -f /var/lock/subsys/powernowd ]; then
+		stop
+		start
+	else
+		msg_not_running powernowd
+		RETVAL=$1
+	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
+	;;
+  stop)
+  	stop
 	;;
   restart)
 	stop
 	start
 	;;
+  try-restart)
+	condrestart 0
+	;;
+  reload|force-reload)
+  	reload
+	;;
   status)
 	status powernowd
 	exit $?
 	;;
   *)
-	msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+	msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
 	exit 3
 esac
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/powernowd.init?r1=1.6&r2=1.7&f=u



More information about the pld-cvs-commit mailing list