[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/luci/init.d luci



CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	EXPERIMENTAL
Changes by:	rmccabe sourceware org	2007-06-05 16:03:33

Modified files:
	luci/init.d    : luci 

Log message:
	fix bz242668 (luci init script can return non-LSB-compliant return codes)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/init.d/luci.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.16.2.1&r2=1.16.2.2

--- conga/luci/init.d/luci	2007/05/22 01:39:51	1.16.2.1
+++ conga/luci/init.d/luci	2007/06/05 16:03:33	1.16.2.2
@@ -46,12 +46,12 @@
 #
 # Only root wants to run this...
 #
-[ `id -u` = 0 ] || exit 0
+[ `id -u` = 0 ] || exit 4
 
 #
 # If we're not configured, then don't start anything.
 #
-[ "${NETWORKING}" = "yes" ] || exit 0
+[ "${NETWORKING}" = "yes" ] || exit 1
 
 
 https_certs_ok()
@@ -221,13 +221,14 @@
 
 case $1 in
 	start)
-		if ! /bin/grep True /var/lib/luci/.default_password_has_been_reset 2>&1 >/dev/null; then
+		grep True /var/lib/luci/.default_password_has_been_reset >&/dev/null
+		if [ $? -ne 0 ]; then
 			echo ""
 			echo "The admin user password must be set before the luci can start"
-			echo "To do so, execute (as root): "
+			echo "To set it, execute (as root): "
 			echo -e "\tluci_admin password\n"
 			/usr/bin/logger -t "$ID" "Luci startup failed: admin password not set (execute 'luci_admin password')"
-			exit 1
+			exit 6
 		fi
 
 		echo -n "Starting $ID: "
@@ -256,17 +257,19 @@
 			echo; echo
 			echo "Point your web browser to $LUCI_URL to access luci"
 			echo
+			exit 0
 		else
 			echo_failure
 			/usr/bin/logger -t "$ID" "Luci startup failed $errmsg"
 			echo
+			exit 1
 		fi
 	;;
 
 	restart)
 		$0 stop
 		rtrn=$?
-		if [ $rtrn -eq 0 ]; then
+		if [ $rtrn -eq 0 ] || [ $rtrn -eq 7 ]; then
 			$0 start
 			rtrn=$?
 		fi
@@ -275,7 +278,7 @@
 	condrestart)
 		system_running
 		rtrn=$?
-		if [ $? -eq 1 ] ; then
+		if [ $rtrn -eq 1 ]; then
 			$0 restart
 			rtrn=$?
 		fi
@@ -288,7 +291,7 @@
 			rtrn=0
 		else
 			echo "$ID is stopped"
-			rtrn=1
+			rtrn=7
 		fi
 	;;
 
@@ -305,8 +308,14 @@
 				rtrn=0
 			else
 				/usr/bin/logger -t "$ID" "Luci shutdown failed"
+				rtrn=1
 			fi
+		elif [ $rtrn -eq 0 ]; then
+			rtrn=7
+		else
+			rtrn=1
 		fi
+
 		if [ $rtrn -eq 0 ]; then
 			echo_success
 		else
@@ -316,12 +325,12 @@
 	;;
 
 	reload)
-		rtrn=0
+		rtrn=3
 	;;
 
 	*)
 		echo "Usage: $0 {start|stop|status|restart|condrestart|reload}"
-		rtrn=1
+		rtrn=3
 	;;
 esac
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]