SOURCES: lircd.init - use functions

glen glen at pld-linux.org
Wed Nov 15 20:45:53 CET 2006


Author: glen                         Date: Wed Nov 15 19:45:53 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions

---- Files affected:
SOURCES:
   lircd.init (1.16 -> 1.17) 

---- Diffs:

================================================================
Index: SOURCES/lircd.init
diff -u SOURCES/lircd.init:1.16 SOURCES/lircd.init:1.17
--- SOURCES/lircd.init:1.16	Wed Nov 15 14:46:20 2006
+++ SOURCES/lircd.init	Wed Nov 15 20:45:47 2006
@@ -18,10 +18,7 @@
 # Get service config
 [ -f /etc/sysconfig/lircd ] && . /etc/sysconfig/lircd
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/lircd ]; then
 		msg_starting "Linux Infrared Remote Control daemon"
@@ -40,8 +37,9 @@
 	else
 		msg_already_running "Linux Infrared Remote Control daemon"
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	# Stop daemons.
 	if [ -f /var/lock/subsys/lircd ]; then
 		msg_stopping "Linux Infrared Remote Control daemon"
@@ -51,6 +49,16 @@
 	else
 		msg_not_running "Linux Infrared Remote Control daemon"
 	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
+	;;
+  stop)
+  	stop
 	;;
   status)
 	status lircd
@@ -58,11 +66,10 @@
 	;;
   restart)
 	test -f /var/lock/subsys/lircmd && RESTART_LIRCMD=yes
-	test -n "$RESTART_LIRCMD" && /etc/rc.d/init.d/lircmd stop
-	$0 stop
-	$0 start
-	RETVAL=$?
-	test -n "$RESTART_LIRCMD" && /etc/rc.d/init.d/lircmd start
+	test -n "$RESTART_LIRCMD" && /sbin/service lircmd stop
+	stop
+	start
+	test -n "$RESTART_LIRCMD" && /sbin/service lircmd start
 	;;
   reload|force-reload)
 	if [ -f /var/lock/subsys/lircd ]; then
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/lircd.init?r1=1.16&r2=1.17&f=u



More information about the pld-cvs-commit mailing list