SOURCES: laptop-mode-tools.init - force-reload is not supposed to ...

qboosh qboosh at pld-linux.org
Wed Jan 9 18:14:34 CET 2008


Author: qboosh                       Date: Wed Jan  9 17:14:34 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- force-reload is not supposed to start service if not running
- added try-restart action

---- Files affected:
SOURCES:
   laptop-mode-tools.init (1.3 -> 1.4) 

---- Diffs:

================================================================
Index: SOURCES/laptop-mode-tools.init
diff -u SOURCES/laptop-mode-tools.init:1.3 SOURCES/laptop-mode-tools.init:1.4
--- SOURCES/laptop-mode-tools.init:1.3	Wed Jan  9 00:07:46 2008
+++ SOURCES/laptop-mode-tools.init	Wed Jan  9 18:14:29 2008
@@ -30,6 +30,16 @@
 	fi
 }
 
+condrestart() {
+	if [ -f /var/lock/subsys/laptop-mode-tools ]; then
+		stop
+		start
+	else
+		msg_not_running "laptop mode"
+		RETVAL=$1
+	fi
+}
+
 RETVAL=0
 # See how we were called.
 case "$1" in
@@ -39,16 +49,22 @@
   stop)
   	stop
 	;;
-  restart|force-reload)
+  restart)
 	stop
 	start
 	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
   status)
   	/usr/sbin/laptop_mode status
 	exit $?
 	;;
   *)
-	msg_usage "$0 {start|stop|restart|force-reload|status}"
+	msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
 	exit 3
 esac
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/laptop-mode-tools.init?r1=1.3&r2=1.4&f=u



More information about the pld-cvs-commit mailing list