diff --git a/xCAT-server/share/xcat/tools/db2xcat b/xCAT-server/share/xcat/tools/db2xcat new file mode 100755 index 000000000..a034f383e --- /dev/null +++ b/xCAT-server/share/xcat/tools/db2xcat @@ -0,0 +1,90 @@ +#!/bin/sh +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +# chkconfig: 345 70 65 +# description: xCAT DB2 service +# processname: db2fmcd + +### BEGIN INIT INFO +# Provides: db2fmcd +# Required-Start: +# Required-Stop: +# Should-Start: +# Default-Start: 3 4 5 +# Default-stop: 0 1 2 6 +# Short-Description: DB2 Fault Monitor +# Description: DB2 Fault Monitor Coordinator +### END INIT INFO + + +RHSuccess() +{ + success + echo +} + +RHFailure() +{ + failure + echo +} +MStatus() +{ + ps ax|grep -v grep|grep db2fmcd: >& /dev/null + if [ "$?" = "0" ]; then + RVAL=0 + echo "db2fmcd service is running" + else + RVAL=3 + echo "db2fmcd service is not running" + fi + return $RVAL +} + +if [ -f /etc/init.d/functions ]; then + #echo RH + . /etc/init.d/functions + START_DAEMON=daemon + STATUS=MStatus + LOG_SUCCESS=RHSuccess + LOG_FAILURE=RHFailure + LOG_WARNING=passed +elif [ -f /lib/lsb/init-functions ]; then + . /lib/lsb/init-functions + START_DAEMON=start_daemon + STATUS=MStatus + LOG_SUCCESS=log_success_msg + LOG_FAILURE=log_failure_msg + LOG_WARNING=log_warning_msg +else + echo "Error, don't know how to start on this platform" + exit 1 +fi + +case $1 in +restart) + echo -n "Restart of db2fmcd not supported " + ;; +reload) + echo -n "Reload of db2fmcd not supported " + ;; +status) + $STATUS + ;; +stop) + echo -n "Stop of db2fmcd not supported " + ;; +start) + $STATUS >& /dev/null + if [ "$?" == "0" ]; then + echo -n "db2fmcd already running\n " + $LOG_WARNING + exit + fi + echo -n "Starting db2fmcd " + /opt/ibm/db2/V9.7/bin/db2fmcd & + ;; +esac + + + +