SOURCES: fancontrol.init - use functions

glen glen at pld-linux.org
Wed Sep 27 15:40:49 CEST 2006


Author: glen                         Date: Wed Sep 27 13:40:49 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions

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

---- Diffs:

================================================================
Index: SOURCES/fancontrol.init
diff -u SOURCES/fancontrol.init:1.1 SOURCES/fancontrol.init:1.2
--- SOURCES/fancontrol.init:1.1	Wed Sep 27 12:45:04 2006
+++ SOURCES/fancontrol.init	Wed Sep 27 15:40:43 2006
@@ -21,9 +21,7 @@
 # Get service config - may override defaults
 # [ -f /etc/sysconfig/fancontrol ] && . /etc/sysconfig/fancontrol
 
-# See how we were called.
-case "$1" in
-  start)
+start() {
   	# Fancontrol needs to check system for pwm control
 	if [ ! -f /etc/sysconfig/fancontrol ]; then
 		nls "Fancontrol not initialized."
@@ -39,8 +37,9 @@
 	else
 		msg_already_running fancontrol
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	if [ -f /var/lock/subsys/fancontrol ]; then
 		# Stop daemons.
 		msg_stopping fancontrol
@@ -49,11 +48,23 @@
 	else
 		msg_not_running fancontrol
 	fi
+}
+
+restart() {
+	stop
+	start
+}
+
+# See how we were called.
+case "$1" in
+  start)
+  	start
+	;;
+  stop)
+  	stop
 	;;
   restart)
-	$0 stop
-	$0 start
-	exit $?
+  	restart
 	;;
   reload)
 	if [ -f /var/lock/subsys/fancontrol ]; then
@@ -66,13 +77,7 @@
 	fi
 	;;
   force-reload)
-	# if program allows reloading without stopping
-	$0 reload
-
-	# or if it doesn't
-	$0 restart
-
-	exit $?
+	restart
 	;;
   init)
   	pwmconfig
================================================================

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



More information about the pld-cvs-commit mailing list