packages: apcupsd/apcupsd.init - add try-restart, correct force-reload

glen glen at pld-linux.org
Sat Dec 17 18:56:58 CET 2011


Author: glen                         Date: Sat Dec 17 17:56:58 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add try-restart, correct force-reload

---- Files affected:
packages/apcupsd:
   apcupsd.init (1.6 -> 1.7) 

---- Diffs:

================================================================
Index: packages/apcupsd/apcupsd.init
diff -u packages/apcupsd/apcupsd.init:1.6 packages/apcupsd/apcupsd.init:1.7
--- packages/apcupsd/apcupsd.init:1.6	Sat Dec 17 18:54:47 2011
+++ packages/apcupsd/apcupsd.init	Sat Dec 17 18:56:52 2011
@@ -52,6 +52,17 @@
 	rm -f /var/lock/subsys/apcupsd
 }
 
+condrestart() {
+	if [ ! -f /var/lock/subsys/apcupsd ]; then
+		msg_not_running "APC UPS monitoring"
+		RETVAL=$1
+		return
+	fi
+
+	stop
+	start
+}
+
 powerdown() {
 	if [ ! -f /etc/apcupsd/powerfail ]; then
 		return
@@ -72,10 +83,16 @@
   stop)
 	stop
 	;;
-  restart|force-reload)
+  restart)
 	stop
 	start
 	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
   powerdown)
 	powerdown
 	;;
@@ -83,7 +100,7 @@
 	/usr/sbin/apcaccess status
 	;;
   *)
-	msg_usage "$0 {start|stop|restart|force-reload|powerdown|status}"
+	msg_usage "$0 {start|stop|restart|try-restart|force-reload|powerdown|status}"
 	exit 3
 esac
 
================================================================

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



More information about the pld-cvs-commit mailing list