SOURCES: cancd.init - use functions

glen glen at pld-linux.org
Mon Sep 29 15:01:24 CEST 2008


Author: glen                         Date: Mon Sep 29 13:01:24 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions

---- Files affected:
SOURCES:
   cancd.init (1.3 -> 1.4) 

---- Diffs:

================================================================
Index: SOURCES/cancd.init
diff -u SOURCES/cancd.init:1.3 SOURCES/cancd.init:1.4
--- SOURCES/cancd.init:1.3	Fri Jan  6 21:23:28 2006
+++ SOURCES/cancd.init	Mon Sep 29 15:01:19 2008
@@ -28,9 +28,7 @@
 	exit 0
 fi
 
-# See how we were called.
-case "$1" in
-  start)
+start() {
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/cancd ]; then
 		msg_starting cancd
@@ -40,8 +38,9 @@
 	else
 		msg_already_running cancd
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	if [ -f /var/lock/subsys/cancd ]; then
 		# Stop daemons.
 		msg_stopping cancd
@@ -50,11 +49,20 @@
 	else
 		msg_not_running cancd
 	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
+	;;
+  stop)
+  	stop
 	;;
   restart|force-reload)
-	$0 stop
-	$0 start
-	exit $?
+	stop
+	start
 	;;
   status)
 	status cancd
@@ -66,6 +74,3 @@
 esac
 
 exit $RETVAL
-
-# This must be last line !
-# vi:syntax=sh
================================================================

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



More information about the pld-cvs-commit mailing list