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

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



CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	EXPERIMENTAL
Changes by:	rmccabe 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


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