cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/init.d luci
Date: 15 Mar 2007 16:52:37 -0000	[thread overview]
Message-ID: <20070315165237.15910.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-03-15 16:52:37

Modified files:
	luci/init.d    : luci 

Log message:
	Revert back to the old init script. This one needs more testing.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/init.d/luci.diff?cvsroot=cluster&r1=1.15&r2=1.16

--- conga/luci/init.d/luci	2007/02/20 17:56:54	1.15
+++ conga/luci/init.d/luci	2007/03/15 16:52:36	1.16
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (C) 2005-2007 Red Hat, Inc.
+# Copyright (C) 2005 Red Hat, Inc.
 #
 # This program is Free Software.  You may modify and/or redistribute it under
 # the terms of the GNU General Public License version 2, or (at your option)
@@ -53,186 +53,185 @@
 
 https_certs_ok()
 {
-	if [ ! -e $HTTPS_PRIVKEY ] ; then
-		return 1
-	fi
-	if [ ! -e $HTTPS_PUBKEY ] ; then
-		return 2
-	fi
-	return 0
+    if [ ! -e $HTTPS_PRIVKEY ] ; then
+	return 1
+    fi
+    if [ ! -e $HTTPS_PUBKEY ] ; then
+	return 2
+    fi
+    return 0
 }
 
 generate_https_certs()
 {
-	rm -f $HTTPS_PRIVKEY $HTTPS_PUBKEY
-	echo -n "generating https SSL certificates...  "
-	/usr/bin/openssl genrsa -out $HTTPS_PRIVKEY 2048 > /dev/null 2>&1
-	/usr/bin/openssl req -new -x509 -key $HTTPS_PRIVKEY -out $HTTPS_PUBKEY -days 1825 -config /var/lib/luci/var/certs/cacert.config
-	/bin/chown $LUCI_USER:$LUCI_GROUP $HTTPS_PRIVKEY $HTTPS_PUBKEY
-	/bin/chmod 600 $HTTPS_PRIVKEY
-	/bin/chmod 644 $HTTPS_PUBKEY
-	ret=$?
-	echo "done"
-	return $ret
+    rm -f $HTTPS_PRIVKEY $HTTPS_PUBKEY
+    echo -n "generating https SSL certificates...  "
+    /usr/bin/openssl genrsa -out $HTTPS_PRIVKEY 2048 > /dev/null 2>&1
+    /usr/bin/openssl req -new -x509 -key $HTTPS_PRIVKEY -out $HTTPS_PUBKEY -days 1825 -config /var/lib/luci/var/certs/cacert.config
+    /bin/chown $LUCI_USER:$LUCI_GROUP $HTTPS_PRIVKEY $HTTPS_PUBKEY
+    /bin/chmod 600 $HTTPS_PRIVKEY
+    /bin/chmod 644 $HTTPS_PUBKEY
+    echo "done"
+    return $?
 }
 
 start()
 {
-	$LUCID >/dev/null 2>/dev/null &
-	
-	https_certs_ok
-	if [ "1$?" != "10" ] ; then
-		generate_https_certs
-	fi
-	sleep 4
-	sed -e s,\\\(^accept.*=\ \\\)\\\(.*\\\),\\\1$LUCI_HTTPS_PORT, $STUNNEL_CONF | $STUNNEL_D -fd 0
-	sleep 4
+    $LUCID >/dev/null 2>/dev/null &
+    
+    https_certs_ok
+    if [ "1$?" != "10" ] ; then
+	generate_https_certs
+    fi
+    sleep 4
+    sed -e s,\\\(^accept.*=\ \\\)\\\(.*\\\),\\\1$LUCI_HTTPS_PORT, $STUNNEL_CONF | $STUNNEL_D -fd 0
+    sleep 4
 }
 
 stop_luci()
 {
-	pid_num=`cat $PIDFILE`
-	kill $pid_num
-	sleep 2
+    pid_num=`cat $PIDFILE`
+    kill $pid_num
+    sleep 2
 }
 
 stop_stunnel()
 {
-	pid_num=`cat $STUNNEL_PID`
-	kill $pid_num
-	sleep 2
+    pid_num=`cat $STUNNEL_PID`
+    kill $pid_num
+    sleep 2
 }
 
 stop()
 {
-	stop_luci
-	stop_stunnel
+    stop_luci
+    stop_stunnel
 }
 
 system_running()
 {
-	# luci
-	LUCI_UP=1
-	if [ -e $PIDFILE ] ; then
-		pid_num=`cat $PIDFILE`
-		kill -0 $pid_num 2>/dev/null
-		if [ "1$?" != "10" ] ; then
-			LUCI_UP=0
-		fi
-	else
-		LUCI_UP=0
-	fi
-	
-	# stunnel
-	ST_UP=2
-	if [ -e $STUNNEL_PID ] ; then
-		pid_num=`cat $STUNNEL_PID`
-		kill -0 $pid_num 2>/dev/null
-		if [ "1$?" != "10" ] ; then
-			ST_UP=0
-		fi
-	else
-		ST_UP=0
-	fi
-	
-	# resolve
-	let res=$LUCI_UP+$ST_UP
-	if [ "1$res" = "10" ] ; then
-		# neither luci nor stunnel is running
-		return 1
-	fi
-	if [ "1$res" = "11" ] ; then
-		# only stunnel running -> stop it
-		stop_stunnel
-	fi
-	if [ "1$res" = "12" ] ; then
-		# only luci running -> stop it
-		stop_luci
-	fi
+    # luci
+    LUCI_UP=1
+    if [ -e $PIDFILE ] ; then
+	pid_num=`cat $PIDFILE`
+	res=`ps -Af | grep python | grep $LUCI_USER | grep $pid_num`
+	if [ "1$res" != "1" ] ; then
+	    LUCI_UP=0
+	fi
+    fi
+    
+    # stunnel
+    ST_UP=2
+    if [ -e $STUNNEL_PID ] ; then
+	pid_num=`cat $STUNNEL_PID`
+	res=`ps -Af | grep stunnel | grep $LUCI_USER | grep $pid_num`
+	if [ "1$res" != "1" ] ; then
+	    ST_UP=0
+	fi
+    fi
+    
+    # resolve
+    let res=$LUCI_UP+$ST_UP
+    if [ "1$res" = "10" ] ; then
 	return 0
+    fi
+    if [ "1$res" = "11" ] ; then
+	# only stunnel running -> stop it
+	stop_stunnel
+    fi
+    if [ "1$res" = "12" ] ; then
+	# only luci running -> stop it
+	stop_luci
+    fi
+    return 1
 }
 
 
+
 case $1 in
 	start)
-		if ! /bin/grep True /var/lib/luci/.default_password_has_been_reset 2>&1 >/dev/null; then
-			echo -e "\nluci's 'admin' password has to be set before the luci server is allowed to start"
-			echo "To do so, execute (as root): " 
-			echo -e "\tluci_admin password\n"
-			/usr/bin/logger -t $ID "startup failed (password not set): execute 'luci_admin password'"
-			exit 1
+	        if ! /bin/grep True /var/lib/luci/.default_password_has_been_reset 2>&1 >/dev/null; then
+		    echo ""
+		    echo "luci's 'admin' password has to be changed before server is allowed to start"
+		    echo "To do so, execute (as root): " 
+		    echo -e "\tluci_admin password"
+		    echo ""
+		    /usr/bin/logger -t $ID "startup failed (password not reset): execute 'luci_admin password'"
+		    exit 1
 		fi
 		
 		echo -n "Starting $ID: "
 		system_running
 		rtrn=$?
 		if [ "1$rtrn" != "10" ] ; then
-			start
+		    start
 		fi
 		system_running
 		rtrn=$?
 		if [ "1$rtrn" = "10" ] ; then
-			echo_success
-			cat $PIDFILE > $GLOB_PIDFILE
-			touch $GLOB_LOCKFILE
-			/usr/bin/logger -t $ID "startup succeeded"
-			/usr/bin/logger -t $ID "Listening on port $LUCI_HTTPS_PORT; accessible using url $LUCI_URL"
-			echo -e "\n\nPlease, point your web browser to $LUCI_URL to access luci\n"
+		    echo_success
+		    cat $PIDFILE > $GLOB_PIDFILE
+		    touch $GLOB_LOCKFILE
+		    /usr/bin/logger -t $ID "startup succeeded"
+		    /usr/bin/logger -t $ID "Listening on port $LUCI_HTTPS_PORT; accessible using url $LUCI_URL"
+		    echo; echo
+		    echo "Please, point your web browser to $LUCI_URL to access luci"
+		    echo
 		else
-			echo_failure
-			/usr/bin/logger -t $ID "startup failed"
-			echo
+		    echo_failure
+		    /usr/bin/logger -t $ID "startup failed"
+		    echo
 		fi
-	;;
+		;;
 
-	restart)
+        restart)
 		$0 stop
 		$0 start 
 		rtrn=$?
-	;;
-		
-	condrestart)
-		system_running
+		;;
+        
+        condrestart)
+	        system_running
 		rtrn=$?
 		if [ "1$rtrn" = "10" ] ; then
-			$0 restart
-			rtrn=$?
+		    $0 restart
+		    rtrn=$?
 		fi
-	;;
+		;;
 
 	status)
-			system_running
+	        system_running
 		rtrn=$?
 		if [ "1$rtrn" = "10" ] ; then
-			echo "$ID is running..."
+		    echo "$ID is running..."
 		else
-			echo "$ID is stopped"
+		    echo "$ID is stopped"
 		fi
-	;;
+		;;
 
 	stop)
 		echo -n "Shutting down $ID: "
 		system_running
 		rtrn=$?
 		if [ "1$rtrn" = "10" ] ; then
-			stop
-			/usr/bin/logger -t $ID "shutdown succeeded"
+		    stop
+		    /usr/bin/logger -t $ID "shutdown succeeded"
 		fi
 		echo_success
 		rm -f $GLOB_PIDFILE
 		rm -f $GLOB_LOCKFILE
 		rtrn=0
 		echo 
-	;;
+		;;
 
-	reload)
-		rtrn=0
-	;;
+        reload)
+               rtrn=0
+	       ;;
 
 	*)
 		echo "Usage: $0 {start|stop|status|restart|condrestart|reload}"
 		rtrn=1
-	;;
+		;;
 
 esac
 



             reply	other threads:[~2007-03-15 16:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-15 16:52 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-02-04 23:36 [Cluster-devel] conga/luci/init.d luci rmccabe
2008-02-05 18:41 rmccabe
2008-02-05 18:31 rmccabe
2007-06-05 16:03 rmccabe
2007-05-22  1:39 rmccabe
2007-02-20 17:56 rmccabe
2006-11-02  0:23 kupcevic
2006-10-03 18:23 kupcevic
2006-09-26  0:22 kupcevic
2006-07-17 20:56 kupcevic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070315165237.15910.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).