SOURCES: ntp.init - use functions

glen glen at pld-linux.org
Mon Aug 27 21:02:48 CEST 2007


Author: glen                         Date: Mon Aug 27 19:02:48 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions

---- Files affected:
SOURCES:
   ntp.init (1.19 -> 1.20) 

---- Diffs:

================================================================
Index: SOURCES/ntp.init
diff -u SOURCES/ntp.init:1.19 SOURCES/ntp.init:1.20
--- SOURCES/ntp.init:1.19	Thu Aug 23 10:14:36 2007
+++ SOURCES/ntp.init	Mon Aug 27 21:02:43 2007
@@ -27,10 +27,7 @@
 
 [ -f /etc/ntp/ntp.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/ntpd ]; then
 		msg_starting ntpd
@@ -40,8 +37,9 @@
 	else
 		msg_already_running ntp
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	if [ -f /var/lock/subsys/ntpd ]; then
 		msg_stopping ntpd
 		killproc ntpd
@@ -49,15 +47,24 @@
 	else
 		msg_not_running ntpd
 	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
+	;;
+  stop)
+  	stop
 	;;
   status)
 	status ntpd
 	exit $?
 	;;
   restart|force-reload)
-	$0 stop
-	$0 start
-	exit $?
+	stop
+	start
 	;;
   *)
 	msg_usage "$0 {start|stop|restart|force-reload|status}"
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/ntp.init?r1=1.19&r2=1.20&f=u



More information about the pld-cvs-commit mailing list