SOURCES: nexus.init - use functions, fixed force-reload, added try-restart

qboosh qboosh at pld-linux.org
Sat Oct 25 16:52:10 CEST 2008


Author: qboosh                       Date: Sat Oct 25 14:52:10 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions, fixed force-reload, added try-restart

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

---- Diffs:

================================================================
Index: SOURCES/nexus.init
diff -u SOURCES/nexus.init:1.3 SOURCES/nexus.init:1.4
--- SOURCES/nexus.init:1.3	Sat Oct 25 14:37:22 2008
+++ SOURCES/nexus.init	Sat Oct 25 16:52:04 2008
@@ -28,11 +28,7 @@
 	exit 0
 fi
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
-	# Check if the service is already running?
+start() {
 	if [ ! -f /var/lock/subsys/nexus ]; then
 		msg_starting nexus
 		su nexus -s /bin/sh -c "/usr/sbin/java-service-wrapper /var/lib/nexus/conf/wrapper.conf wrapper.syslog.ident=nexus wrapper.daemonize=TRUE wrapper.pidfile=/var/lib/nexus/nexus.pid"
@@ -41,6 +37,33 @@
 	else
 		msg_already_running nexus
 	fi
+}
+
+stop() {
+	if [ -f /var/lock/subsys/nexus ]; then
+		msg_stopping nexus
+		killproc nexus
+		rm -f /var/lock/subsys/nexus /var/lib/nexus/nexus.pid > /dev/null 2>&1
+	else
+		msg_not_running nexus
+	fi
+}
+
+condrestart() {
+	if [ -f /var/lock/subsys/nexus ]; then
+		stop
+		start
+	else
+		msg_not_running nexus
+		RETVAL=$1
+	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	start
 	;;
   console)
 	# Check if the service is already running?
@@ -54,26 +77,24 @@
 	fi
 	;;
   stop)
-	# Stop daemons.
-	if [ -f /var/lock/subsys/nexus ]; then
-		msg_stopping nexus
-		killproc nexus
-		rm -f /var/lock/subsys/nexus /var/lib/nexus/nexus.pid > /dev/null 2>&1
-	else
-		msg_not_running nexus
-	fi
+	stop
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
 	;;
   status)
 	status nexus
 	exit $?
 	;;
-  restart|force-reload)
-	$0 stop
-	$0 start
-	exit $?
-	;;
   *)
-	msg_usage "$0 {start|console|stop|restart|force-reload|status}"
+	msg_usage "$0 {start|console|stop|restart|try-restart|force-reload|status}"
 	exit 3
 esac
 
================================================================

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



More information about the pld-cvs-commit mailing list