SOURCES: asterisk.init - use functions

glen glen at pld-linux.org
Thu Apr 19 10:27:17 CEST 2007


Author: glen                         Date: Thu Apr 19 08:27:17 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions

---- Files affected:
SOURCES:
   asterisk.init (1.8 -> 1.9) 

---- Diffs:

================================================================
Index: SOURCES/asterisk.init
diff -u SOURCES/asterisk.init:1.8 SOURCES/asterisk.init:1.9
--- SOURCES/asterisk.init:1.8	Thu Dec  8 02:02:49 2005
+++ SOURCES/asterisk.init	Thu Apr 19 10:27:11 2007
@@ -15,6 +15,9 @@
 # config:	/etc/asterisk/asterisk.conf
 
 
+# Sanity check
+[ -f /etc/asterisk/asterisk.conf ] || exit 0
+
 # Source function library
 . /etc/rc.d/init.d/functions
 
@@ -34,13 +37,7 @@
 	exit 0
 fi
 
-# Sanity check
-[ -f /etc/asterisk/asterisk.conf ] || exit 0
-
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/asterisk ]; then
 		msg_starting Asterisk
@@ -50,8 +47,9 @@
 	else
 		msg_already_running Asterisk
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	# Stop daemons.
 	if [ -f /var/lock/subsys/asterisk ]; then
 		msg_stopping Asterisk
@@ -60,11 +58,20 @@
 	else
 		msg_not_running Asterisk
 	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
 	;;
   reload)
 	if [ -f /var/lock/subsys/asterisk ]; then
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/asterisk.init?r1=1.8&r2=1.9&f=u



More information about the pld-cvs-commit mailing list