tog-pegasus/pegasus-2.6.1-init_script.patch

82 lines
2.0 KiB
Diff

--- pegasus-2.6.1/rpm/tog-pegasus.rc_old 2007-08-30 09:30:13.000000000 +0200
+++ pegasus-2.6.1/rpm/tog-pegasus.rc 2007-08-30 10:21:42.000000000 +0200
@@ -5,17 +5,22 @@
# processname: cimserver
# pidfile: /var/run/tog-pegasus/cimserver.pid
#
+
+### BEGIN INIT INFO
+# Provides: lsb-pegasus
+# Required-Start: $syslog $network
+# Should-Start: $time
+# Required-Stop: $syslog
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 6
+# Description: init script for Pegasus CIMServer
+### END INIT INFO
+
CIMSERVER_BIN=/usr/sbin/cimserver
prog=cimserver
LOCKFILE=/var/lock/subsys/tog-pegasus
. /etc/rc.d/init.d/functions
-if [ ! -x $CIMSERVER_BIN ]; then
- echo -n "tog-pegasus $1: $CIMSERVER_BIN not found or not executable.";
- failure;
- exit 1;
-fi;
-
[ -e /etc/sysconfig/tog-pegasus ] && . /etc/sysconfig/tog-pegasus;
PEGASUS_SSL_CONF_FILE=${PEGASUS_SSL_CONF_FILE:=/etc/Pegasus/ssl.cnf}
@@ -26,7 +31,26 @@
RETVAL=0
case "$1" in
- start)
+ start)
+ pid=`pidofproc $CIMSERVER_BIN`
+ RETVAL=$?
+ if [ "$RETVAL" -eq 0 ]; then
+ echo "tog-pegasus $1: $CIMSERVER_BIN is already running";
+ exit 0;
+ fi;
+
+ if [ ! -e $CIMSERVER_BIN ]; then
+ echo "tog-pegasus $1: $CIMSERVER_BIN not found";
+ failure;
+ exit 5;
+ fi;
+
+ if [ ! -x $CIMSERVER_BIN ]; then
+ echo "tog-pegasus $1: $CIMSERVER_BIN not executable";
+ failure;
+ exit 4;
+ fi;
+
if [ ! -e ${PEGASUS_SSL_CONF_FILE} ] || [ ! -e ${PEGASUS_SSL_CERT_FILE} ] ||
[ ! -e ${PEGASUS_SSL_KEY_FILE} ] || [ ! -e ${PEGASUS_SSL_TRUSTSTORE} ]; then
if [ -x /usr/share/Pegasus/scripts/genOpenPegasusSSLCerts ]; then
@@ -71,10 +95,10 @@
RETVAL=$?
if [ "$RETVAL" -eq 0 ]; then
echo -n $"CIM server ($pid) is running";
- success;
+ RETVAL=0
else
echo -n $"CIM server is not running";
- failure;
+ RETVAL=3
fi
echo
;;
@@ -103,7 +127,7 @@
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload|force-reload|try-restart}"
- exit 1
+ RETVAL=3
esac
exit $RETVAL