All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/ricci/init.d ricci
Date: 5 Jun 2007 16:22:59 -0000	[thread overview]
Message-ID: <20070605162259.30228.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	EXPERIMENTAL
Changes by:	rmccabe at sourceware.org	2007-06-05 16:22:59

Modified files:
	ricci/init.d   : ricci 

Log message:
	exit with LSB-compliant codes

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

--- conga/ricci/init.d/ricci	2007/01/18 03:02:38	1.10
+++ conga/ricci/init.d/ricci	2007/06/05 16:22:59	1.10.4.1
@@ -1,10 +1,9 @@
 #!/bin/sh
 #
-# Copyright (C) 2005 Red Hat, Inc.
+# Copyright (C) 2005-2007 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)
-# any later version.
+# the terms of the GNU General Public License version 2.
 #
 # description:  Starts and stops Red Hat Cluster and Storage Remote \
 #               Configuration Interface (ricci)
@@ -32,127 +31,125 @@
 #
 # 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
 
 ssl_certs_ok()
 {
-    if [ ! -e $SSL_PRIVKEY ] ; then
-	return 1
-    fi
-    if [ ! -e $SSL_PUBKEY ] ; then
-	return 2
-    fi
-    return 0
+	if [ ! -f "$SSL_PRIVKEY" ] ; then
+		return 1
+	fi
+	if [ ! -f "$SSL_PUBKEY" ] ; then
+		return 2
+	fi
+	return 0
 }
 
 generate_ssl_certs()
 {
-    rm -f $SSL_PUBKEY $SSL_PRIVKEY
-    echo -n "generating SSL certificates...  "
-    /usr/bin/openssl genrsa -out $SSL_PRIVKEY 2048 > /dev/null 2>&1
-    /usr/bin/openssl req -new -x509 -key $SSL_PRIVKEY -out $SSL_PUBKEY -days 1825 -config /var/lib/ricci/certs/cacert.config
-    /bin/chown $RUNASUSER:$RUNASUSER $SSL_PRIVKEY $SSL_PUBKEY
-    /bin/chmod 644 $SSL_PUBKEY
-    /bin/chmod 600 $SSL_PRIVKEY
-    echo "done"
-    return $?
+	rm -f "$SSL_PUBKEY" "$SSL_PRIVKEY"
+	echo -n "generating SSL certificates...  "
+	/usr/bin/openssl genrsa -out "$SSL_PRIVKEY" 2048 >&/dev/null
+	/usr/bin/openssl req -new -x509 -key "$SSL_PRIVKEY" -out "$SSL_PUBKEY" -days 1825 -config /var/lib/ricci/certs/cacert.config
+	/bin/chown $RUNASUSER:$RUNASUSER "$SSL_PRIVKEY" "$SSL_PUBKEY"
+	/bin/chmod 644 "$SSL_PUBKEY"
+	/bin/chmod 600 "$SSL_PRIVKEY"
+	ret=$?
+	echo "done"
+	return $ret
 }
 
 
 case $1 in
 	start)
-	        service messagebus status > /dev/null 2>&1
+		service messagebus status >&/dev/null
 		if [ $? -ne 0 ]; then
-		    service messagebus start
-		    service messagebus status > /dev/null 2>&1
-		    if [ $? -ne 0 ]; then
-			echo "not starting ricci..."
-			/usr/bin/logger -t $RICCID "startup failed"
-			exit 1
-		    fi
+			service messagebus start
+			service messagebus status >&/dev/null
+			if [ $? -ne 0 ]; then
+				echo "not starting ricci..."
+				/usr/bin/logger -t $RICCID "startup failed"
+				exit 1
+			fi
 		fi
-	        service oddjobd status > /dev/null 2>&1
+		service oddjobd status >&/dev/null
 		if [ $? -ne 0 ]; then
-		    service oddjobd start
-		    service oddjobd status > /dev/null 2>&1
-		    if [ $? -ne 0 ]; then
-			echo "not starting ricci..."
-			/usr/bin/logger -t $RICCID "startup failed"
-			exit 1
-		    fi
+			service oddjobd start
+			service oddjobd status >&/dev/null
+			if [ $? -ne 0 ]; then
+				echo "not starting ricci..."
+				/usr/bin/logger -t $RICCID "startup failed"
+				exit 1
+			fi
 		fi
 		
-		service saslauthd start > /dev/null 2>&1
-		
+		service saslauthd start >&/dev/null
 		ssl_certs_ok
 		if [ "1$?" != "10" ] ; then
-		    generate_ssl_certs
+			generate_ssl_certs
 		fi
 		
-		NewUID=`cat /etc/passwd | grep "^$RUNASUSER:" | sed -e 's/^[^:]*:[^:]*://' -e 's/:.*//'`
+		NewUID=`grep "^$RUNASUSER:" /etc/passwd | sed -e 's/^[^:]*:[^:]*://' -e 's/:.*//'`
 		echo -n $"Starting $ID: "
 		daemon $RICCID -u $NewUID
 		rtrn=$?
 		echo 
+
 		if [ $rtrn -eq 0 ]; then
-		    touch $LOCKFILE
-		    /usr/bin/logger -t $RICCID "startup succeeded"
+			touch "$LOCKFILE"
+			/usr/bin/logger -t $RICCID "startup succeeded"
 		else
-		    /usr/bin/logger -t $RICCID "startup failed"
+			/usr/bin/logger -t $RICCID "startup failed"
 		fi
-		;;
+	;;
 
-        restart)
+	restart)
 		$0 stop
 		$0 start 
 		rtrn=$?
-		;;
+	;;
 
 	status)
 		status $RICCID
 		rtrn=$?
-		;;
+	;;
 
 	stop)
 		echo -n "Shutting down $ID: "
 		killproc $RICCID SIGTERM
 		rtrn=$?
 		if [ $rtrn -eq 0 ]; then
-		    sleep 8
-		    rm -f $PIDFILE
-		    rm -f $LOCKFILE
-		    /usr/bin/logger -t $RICCID "shutdown succeeded"
+			sleep 8
+			rm -f $PIDFILE
+			rm -f $LOCKFILE
+			/usr/bin/logger -t $RICCID "shutdown succeeded"
+			rtrn=0
 		else
-		    /usr/bin/logger -t $RICCID "shutdown failed"
+			/usr/bin/logger -t $RICCID "shutdown failed"
+			rtrn=1
 		fi
-		rtrn=0
 		echo 
-		;;
+	;;
 
-        condrestart)
-               if [ -f ${PIDFILE} ] ; then
-		   $0 restart
-		   rtrn=$?
-	       fi
-	       ;;
-
-        reload)
-               rtrn=0
-	       ;;
+	condrestart)
+		if [ -f ${PIDFILE} ] ; then
+			$0 restart
+			rtrn=$?
+		fi
+	;;
+
+	reload)
+		rtrn=3
+	;;
 
 	*)
 		echo "Usage: $0 {start|stop|status|restart|condrestart|reload}"
-		rtrn=1
-		;;
-
+		rtrn=3
+	;;
 esac
 
 exit $rtrn



             reply	other threads:[~2007-06-05 16:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-05 16:22 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-02-19 22:49 [Cluster-devel] conga/ricci/init.d ricci rmccabe

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=20070605162259.30228.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.