resources/OCF/ids
author Keisuke MORI <kskmori@intellilink.co.jp>
Thu Jul 17 17:01:29 2008 +0900 (6 days ago)
changeset 11998 e0ee7d4cec7b
parent 111788d99007ef4d0
permissions -rw-r--r--
RPM: fixed an useradd error when installing at the very first time
     1 #!/bin/sh
     2 #
     3 #
     4 # ids
     5 #
     6 # Description:
     7 #
     8 # OCF resource agent that manages an 
     9 # IBM Informix Dynamic Server (IDS) instance 
    10 # as an High-Availability resource.
    11 ####
    12 #
    13 # Author:			Lars D. Forseth, <lars.forseth@de.ibm.com> or <lars@forseth.de>
    14 # Created:			May 25th 2007
    15 # Last Modified:	July 30th 2007
    16 # Support:			linux-ha@lists.linux-ha.org
    17 # License:			GNU General Public License (GPL), Version 2 or later
    18 # Copyright:		(c) 2002 - 2007 International Business Machines, Inc.
    19 #
    20 # This code is inspired by the db2 OCF resource agent 
    21 # written by Alan Robertson, <alanr@unix.sh>
    22 ####
    23 #
    24 # This program is free software; you can redistribute it and/or modify
    25 # it under the terms of the GNU General Public License as published by
    26 # the Free Software Foundation; either version 2 of the License, or
    27 # (at your option) any later version.
    28 
    29 #
    30 # This program is distributed in the hope that it would be useful, but
    31 # WITHOUT ANY WARRANTY; without even the implied warranty of
    32 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    33 #
    34 # Further, this software is distributed without any warranty that it is
    35 # free of the rightful claim of any third person regarding infringement
    36 # or the like.  Any license provided herein, whether implied or
    37 # otherwise, applies only to this software file.  Patent licenses, if
    38 # any, provided herein do not apply to combinations of this program with
    39 # other software, or any other product whatsoever.
    40 #
    41 # You should have received a copy of the GNU General Public License
    42 # along with this program; if not, write the Free Software Foundation,
    43 # Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
    44 ####
    45 #
    46 # Example usage as it would appear in /etc/ha.d/haresources:
    47 #		node1 192.168.0.1 ids::/informix::ids1::onconfig.ids1
    48 #
    49 #
    50 # --> Note that passing dbname and sqltestquery in heartbeat version 1 style is not supported!
    51 #
    52 # See usage() function below for more details...
    53 ####
    54 #
    55 # OCF instance parameters:
    56 #   OCF_RESKEY_informixdir
    57 #	OCF_RESKEY_informixserver 
    58 #	OCF_RESKEY_onconfig
    59 #	OCF_RESKEY_dbname
    60 #	OCF_RESKEY_sqltestquery
    61 ####
    62 
    63 
    64 #
    65 # Include general OCF functions and variables (such as OCF return codes).
    66 #
    67 . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
    68 
    69 
    70 #
    71 # Function that displays the usage of this script.
    72 #
    73 ids_usage() {
    74 	methods=`ids_methods`
    75 	methods=`echo $methods | tr ' ' '|'`
    76 
    77 	echo "
    78 	usage: $0 ($methods)
    79 
    80 	$0 manages an IBM Informix Dynamic Server (IDS) instance as an High-Availability resource.
    81 
    82 	The 'start' operation starts the database.
    83 	The 'stop' operation stops the database.
    84 	The 'status' operation reports whether the database is running
    85 	The 'monitor' operation reports whether the database seems to be working
    86 	The 'validate-all' operation reports whether the parameters are valid
    87 	The 'methods' operation lists the methods $0 supports
    88 	The 'usage' operation displays this text
    89 	The 'meta-data' operation returns the meta-data (in XML) of this resource script
    90     "
    91 }
    92 
    93 
    94 #
    95 # Function that displays the possible methods this script supports.
    96 #
    97 ids_methods() {
    98 	echo " 
    99 	start
   100 	stop
   101 	status
   102 	monitor
   103 	validate-all
   104 	methods
   105 	usage
   106 	meta-data
   107 	"
   108 }
   109 
   110 
   111 #
   112 # Function that displays the meta-data of this OCF resource agent.
   113 #
   114 ids_meta_data() {
   115     cat <<-!
   116 <?xml version="1.0"?>
   117 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
   118 <resource-agent name="ids">
   119 <version>1.0</version>
   120 
   121 
   122 <longdesc lang="en">
   123 OCF resource agent to manage an IBM Informix Dynamic Server (IDS) instance as an High-Availability resource.
   124 </longdesc>
   125 <shortdesc lang="en">OCF resource agent for the IBM's database server called Informix Dynamic Server (IDS)</shortdesc>
   126 
   127 
   128 <parameters>
   129 
   130 <parameter name="informixdir" required="0">
   131 <longdesc lang="en">
   132 The value the environment variable INFORMIXDIR has after a typical installation of IDS.
   133 Or in other words: the path (without trailing '/') where IDS was installed to.
   134 If this parameter is unspecified the script will try to get the value from the shell environment.
   135 </longdesc>
   136 <shortdesc lang="en">
   137 INFORMIXDIR environment variable
   138 </shortdesc>
   139 <content type="string" default="" />
   140 </parameter>
   141 
   142 <parameter name="informixserver" required="0">
   143 <longdesc lang="en">
   144 The value the environment variable INFORMIXSERVER has after a typical installation of IDS.
   145 Or in other words: the name of the IDS server instance to manage.
   146 If this parameter is unspecified the script will try to get the value from the shell environment.
   147 </longdesc>
   148 <shortdesc lang="en">
   149 INFORMIXSERVER environment variable
   150 </shortdesc>
   151 <content type="string" default="" />
   152 </parameter>
   153 
   154 <parameter name="onconfig" required="0">
   155 <longdesc lang="en">
   156 The value the environment variable ONCONFIG has after a typical installation of IDS.
   157 Or in other words: the name of the configuration file for the IDS instance specified in INFORMIXSERVER. 
   158 The specified configuration file will be searched at '$INFORMIXDIR/etc/$ONCONFIG'.
   159 If this parameter is unspecified the script will try to get the value from the shell environment.
   160 </longdesc>
   161 <shortdesc lang="en">
   162 ONCONFIG environment variable
   163 </shortdesc>
   164 <content type="string" default="" />
   165 </parameter>
   166 
   167 <parameter name="dbname" required="0">
   168 <longdesc lang="en">
   169 This parameter defines which database to use in order to monitor the IDS instance.
   170 If this parameter is unspecified the script will use the 'sysmaster' database as a default.
   171 </longdesc>
   172 <shortdesc lang="en">
   173 database to use for monitoring, defaults to 'sysmaster'
   174 </shortdesc>
   175 <content type="string" default="sysmaster" />
   176 </parameter>
   177 
   178 <parameter name="sqltestquery" required="0">
   179 <longdesc lang="en">
   180 SQL test query to run on the database specified by the parameter 'dbname' 
   181 in order to monitor the IDS instance and determine if it's functional or not.
   182 If this parameter is unspecified the script will use 'SELECT COUNT(*) FROM systables;' as a default.
   183 </longdesc>
   184 <shortdesc lang="en">
   185 SQL test query to use for monitoring, defaults to 'SELECT COUNT(*) FROM systables;'
   186 </shortdesc>
   187 <content type="string" default="SELECT COUNT(*) FROM systables;" />
   188 </parameter>
   189 
   190 </parameters>
   191 
   192 
   193 <actions>
   194 <action name="start" timeout="120" />
   195 <action name="stop" timeout="120" />
   196 <action name="status" timeout="60" />
   197 <action name="monitor" depth="0" timeout="30" interval="10" start-delay="10" />
   198 <action name="validate-all" timeout="5" />
   199 <action name="meta-data" timeout="5" />
   200 <action name="methods" timeout="5" />
   201 <action name="usage" timeout="5" />
   202 </actions>
   203 
   204 
   205 </resource-agent>
   206 !
   207 }
   208 
   209 
   210 #
   211 # Function that either forwards log messages to the ocf_log function
   212 # provided by heartbeat or simply prints them to standard out via echo.
   213 # This is determined by setting the variable "idslogger" to "echo" or "ocf".
   214 # The default for "idslogger" is "ocf".
   215 #
   216 ids_log() {
   217 
   218 	# Where should the passed log messages be passed to,
   219 	# to the standard output via the echo command ("echo")
   220 	# or to the ocf_log function provided by heartbeat ("ocf") ?
   221 	# Default is "ocf".
   222 	idslogger="ocf"
   223 
   224 	# When the variable "idsdebug" is not set to "true"
   225 	# this function (ids_log) will not print any info message
   226 	# that has been forwarded to it!
   227 	# This is done in order to spare if-statements within the 
   228 	# other functions in this script and to centralize the decision
   229 	# whether to have a chatty resource script or not... ;)
   230 	# Nevertheless, error messages will always be printed!
   231 	idsdebug=false
   232 
   233 	# Only continue if the two expected parameters 
   234 	# are not empty and "idsdebug" is set to "true"
   235 	# or the message is of type "error".
   236 	if [ $# -eq 2 -a -n "$1" -a -n "$2" ]; then
   237 		if [ "$idsdebug" = "true" -o "$1" = "error" ]; then
   238 			case $idslogger in
   239 				# Print messages to stdout via echo command.
   240 				echo)
   241 					echo "`date +'%b %d %H:%M:%S'`: [$1] $2";;
   242 				# Pass messages to ocf_log function.
   243 				ocf|*)
   244 					ocf_log "$1" "$2";;
   245 			esac
   246 		fi
   247 	fi		
   248 }
   249 
   250 
   251 #
   252 # Function that prints the current values of important environment variables
   253 # needed by the script and the IDS instance itself. The just mentioned variables are:
   254 # - INFORMIXDIR
   255 # - INFORMIXSERVER
   256 # - ONCONFIG
   257 # - PATH
   258 # - LD_LIBRARY_PATH
   259 #
   260 ids_debug() {
   261 	ids_log info "called ids_debug"	
   262 
   263 	ids_log info "INFORMIXDIR=$INFORMIXDIR"
   264 	ids_log info "OCF_RESKEY_informixdir=$OCF_RESKEY_informixdir"
   265 	
   266 	ids_log info "INFORMIXSERVER=$INFORMIXSERVER"
   267 	ids_log info "OCF_RESKEY_informixserver=$OCF_RESKEY_informixserver"
   268 	
   269 	ids_log info "ONCONFIG=$ONCONFIG"
   270 	ids_log info "OCF_RESKEY_onconfig=$OCF_RESKEY_onconfig"
   271 	
   272 	ids_log info "PATH=$PATH"
   273 	ids_log info "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
   274 	
   275 	ids_log info "dbname=$OCF_RESKEY_dbname"
   276 	ids_log info "sqltestquery=$OCF_RESKEY_sqltestquery"
   277 
   278 	ids_log info "this script is run as user: `id`"
   279 	ids_log info "...in the current working directory: `pwd`"
   280 }
   281 
   282 
   283 #
   284 # Function that validates if the passed parameters are valid and sets them if valid. 
   285 # If the first three parameters have not been passed, 
   286 # this function checks whether they have been already set in the parent's shell environment.
   287 # The variables that are checked and set (only the capitalized ones are set) are:
   288 # - INFORMIXDIR
   289 # - INFORMIXSERVER
   290 # - ONCONFIG
   291 # - PATH
   292 # - LD_LIBRARY_PATH
   293 # - dbname
   294 # - sqltestquery
   295 #
   296 ids_validate() {
   297 	
   298 	ids_log info "called ids_validate"
   299 	rc=$OCF_SUCCESS
   300 
   301 	# Check if INFORMIX, INFORMIXSERVER and ONCONFIG 
   302 	# have been passed or set and validate them.
   303 	
   304 	# OCF vars not passed, vars empty - set and export them to the shell environment.
   305 	if [ -n "$OCF_RESKEY_informixdir" -a -n "$OCF_RESKEY_informixserver" -a -n "$OCF_RESKEY_onconfig" ]; then
   306 		ids_log info "ids_validate: passed vars not empty"
   307 		
   308 		INFORMIXDIR=$OCF_RESKEY_informixdir
   309 		export INFORMIXDIR
   310 
   311 		INFORMIXSERVER=$OCF_RESKEY_informixserver
   312 		export INFORMIXSERVER
   313 
   314 		ONCONFIG=$OCF_RESKEY_onconfig
   315 		export ONCONFIG
   316 	fi
   317 
   318 	# Check if INFORMIXDIR is non-empty and a directory (and if there was an error so far).
   319 	if [ $rc -eq $OCF_SUCCESS -a -n "$INFORMIXDIR" -a -d "$INFORMIXDIR" ]; then
   320 		ids_log info "ids_validate: INFORMIXDIR is valid: $INFORMIXDIR"
   321 		rc=$OCF_SUCCESS
   322 	else
   323 		ids_log error "ids_validate: INFORMIXDIR is invalid: $INFORMIXDIR"
   324 		rc=$OCF_ERR_ARGS
   325 	fi
   326 
   327 	# Check if INFORMIXSERVER is non-empty (and if there was an error so far).
   328 	if [ $rc -eq $OCF_SUCCESS -a -n "$INFORMIXSERVER" ]; then
   329 		ids_log info "ids_validate: INFORMIXSERVER is valid: $INFORMIXSERVER"
   330 		rc=$OCF_SUCCESS
   331 	else
   332 		ids_log error "ids_validate: INFORMIXSERVER is invalid: $INFORMIXSERVER"
   333 		rc=$OCF_ERR_ARGS
   334 	fi
   335 
   336 	# Check if ONCONFIG is non-empty and a non-empty file (and if there was an error so far).
   337 	if [ $rc -eq $OCF_SUCCESS -a -n "$ONCONFIG" -a -s "$INFORMIXDIR/etc/$ONCONFIG" ]; then
   338 		ids_log info "ids_validate: ONCONFIG is a non-empty file in: \$INFORMIXDIR/etc/\$ONCONFIG where ONCONFIG=$ONCONFIG"
   339 		rc=$OCF_SUCCESS
   340 	else 
   341 		if [ -z "$ONCONFIG" -a -s "$INFORMIXDIR/etc/onconfig" ]; then
   342 			ONCONFIG="onconfig" 
   343 			export ONCONFIG
   344 			ids_log info "ids_validate: ONCONFIG is a non-empty file in: \$INFORMIXDIR/etc/\$ONCONFIG where ONCONFIG=$ONCONFIG"
   345 			rc=$OCF_SUCCESS
   346 		else
   347 			if [ -z "$ONCONFIG" -a -s "$INFORMIXDIR/etc/onconfig.std" ]; then
   348 				ONCONFIG="onconfig.std"
   349             	export ONCONFIG
   350 				ids_log info "ids_validate: ONCONFIG is a non-empty file in: \$INFORMIXDIR/etc/\$ONCONFIG where ONCONFIG=$ONCONFIG"
   351             	rc=$OCF_SUCCESS				
   352 			else
   353 				ids_log error "ids_validate: ONCONFIG is invalid, searched for it in: \$INFORMIXDIR/etc/\$ONCONFIG where ONCONFIG=$ONCONFIG"
   354 				rc=$OCF_ERR_ARGS
   355 			fi
   356 		fi
   357 	fi
   358 
   359 	# Check if the commands oninit, onstat, onmode and dbaccess	exist in INFORMIXDIR/bin/
   360 	# and whether they are executable (do this only if there wasn't an error so far).
   361 	if [ $rc -eq $OCF_SUCCESS -a -x "$INFORMIXDIR/bin/oninit" -a -x "$INFORMIXDIR/bin/onstat" -a -x "$INFORMIXDIR/bin/onmode" -a -x "$INFORMIXDIR/bin/dbaccess" ]; then
   362 		ids_log info "ids_validate: oninit, onstat and dbaccess exist and are executable in: \$INFORMIXDIR/bin/"
   363 		rc=$OCF_SUCCESS
   364 	else
   365 		ids_log error "ids_validate: oninit, onstat or dbacces don't exist or they are not executable in: \$INFORMIXDIR/bin/"
   366 		rc=$OCF_ERR_PERM
   367 	fi
   368 
   369 	# Extend PATH and LD_LIBRARY_PATH as needed for the IDS instance to run properly
   370 	# BUT: only do this if it hasn't been done before! Otherwise PATH and LD_LIBRARY_PATH will
   371 	# keep on growing every time heartbeat calls the IDS resource agent script! ;)
   372 	echo $PATH | grep $INFORMIXDIR > /dev/null 2>&1
   373 	inpath=$?
   374 	
   375 	if [ $rc -eq $OCF_SUCCESS -a $inpath -ne 0 ]; then 
   376 		PATH="${INFORMIXDIR}/bin":${PATH}
   377 		export PATH
   378 		ids_log info "ids_validate: PATH did not contain INFORMIXDIR, added \$INFORMIXDIR/bin"
   379 	else
   380 		ids_log info "ids_validate: INFORMIXDIR already in PATH, where PATH=$PATH"
   381 	fi
   382 
   383 	echo $LD_LIBRARY_PATH | grep $INFORMIXDIR > /dev/null 2>&1
   384 	inldlibpath=$?
   385 
   386 	if [ $rc -eq $OCF_SUCCESS -a $inldlibpath -ne 0 ]; then
   387 		LD_LIBRARY_PATH="${INFORMIXDIR}/lib:${INFORMIXDIR}/lib/esql"
   388 		export LD_LIBRARY_PATH
   389 		ids_log info "ids_validate: LD_LIBRARY_PATH did not contain INFORMIXDIR, added \$INFORMIXDIR/lib and \$INFORMIXDIR/lib/esql, added them"
   390 	else
   391 		ids_log info "ids_validate: INFORMIXDIR already in LD_LIBRARY_PATH, where LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
   392 	fi
   393 	
   394 	# Check if dbname is empty (and if there was an error so far)
   395 	# if it is empty, assign default.
   396 	if [ $rc -eq $OCF_SUCCESS -a -n "$OCF_RESKEY_dbname" ]; then
   397 		ids_log info "ids_validate: dbname is valid: $OCF_RESKEY_dbname"
   398 		rc=$OCF_SUCCESS
   399 	else
   400 		ids_log info "ids_validate: dbname is invalid: $OCF_RESKEY_dbname"
   401 		ids_log info "ids_validate: using 'sysmaster' as default..."
   402 		OCF_RESKEY_dbname="sysmaster"
   403 		export OCF_RESKEY_dbname
   404 		rc=$OCF_SUCCESS
   405 	fi
   406 
   407 	# Check if sqltestquery is empty (and if there was an error so far)
   408 	# if it is empty, assign default.
   409 	if [ $rc -eq $OCF_SUCCESS -a -n "$OCF_RESKEY_sqltestquery" ]; then
   410 		ids_log info "ids_validate: sqltestquery is valid: $OCF_RESKEY_sqltestquery"
   411 		rc=$OCF_SUCCESS
   412 	else
   413 		ids_log info "ids_validate: sqltestquery is invalid: $OCF_RESKEY_sqltestquery"
   414 		ids_log info "ids_validate: using 'SELECT COUNT(*) FROM systables;' as default..."
   415         OCF_RESKEY_sqltestquery="SELECT COUNT(*) FROM systables;"
   416         export OCF_RESKEY_sqltestquery
   417         rc=$OCF_SUCCESS
   418 	fi
   419 
   420 	# Return exit status code.
   421 	return $rc
   422 }
   423 
   424 
   425 #
   426 # Function that start the IDS instance and reports any error that
   427 # may occur while starting.
   428 #
   429 ids_start() {
   430 
   431 	ids_log info "called ids_start"
   432 	
   433 	# Get current status of IDS instance.
   434 	ids_status
   435 	stat=$?
   436 
   437 	case $stat in
   438 		
   439 		# IDS instance already running - exit with success.
   440 		$OCF_SUCCESS)
   441 			ids_log info "ids_start: IDS instance already running: $stat"
   442 			rc=$OCF_SUCCESS;;
   443 	
   444 		# IDS instance in undefined state - exit with error.
   445 		$OCF_ERR_GENERIC)
   446 			ids_log error "ids_start: IDS instance in undefined state: $stat"
   447 			ids_debug
   448 			rc=$OCF_ERR_GENERIC;;	
   449 
   450 		# IDS instance not running - try to start it.
   451 		$OCF_NOT_RUNNING)
   452 			ids_log info "ids_start: executing 'oninit' now..."	
   453 			oninit
   454 			stat=$?
   455 			ids_log info "ids_start: done executing 'oninit': $stat"
   456 			
   457 			# The oninit command terminated successfully - check new state of IDS instance.
   458 			if [ $stat -eq 0 ]; then
   459 				# Initialize stat with failure exit status code.
   460 				stat=$OCF_ERR_GENERIC
   461 				# Endless loop that waits until IDS is completely online.
   462 				# If IDS takes too long to achieve this or even hangs, 
   463 				# the timeout settings of heartbeat will cancel the starting 
   464 				# of the IDS resource and therefore terminate the loop.
   465 				while [ $stat -ne $OCF_SUCCESS ]; do
   466 					ids_status
   467 					stat=$?
   468 				done
   469 				# IDS is running now - success.
   470 				ids_log info "ids_start: IDS instance successfully started: $stat"
   471 				rc=$OCF_SUCCESS
   472 			# The oninit command terminated with an error - starting the IDS resource failed!
   473 			else
   474 				ids_log error "ids_start: starting IDS instance failed: $stat"
   475 				ids_debug
   476 				rc=$OCF_ERR_GENERIC			
   477 			fi
   478 			;;
   479 
   480 		# Unexpected state - return OCF_ERR_UNIMPLEMENTED error.
   481 		*) 
   482 			ids_log error "ids_start: unexpected state returned from ids_status: $stat"
   483 			ids_debug
   484 			rc=$OCF_ERR_UNIMPLEMENTED;;				
   485 
   486 	esac
   487 
   488 	# Return exit status code.
   489 	return $rc
   490 }
   491 
   492 
   493 #
   494 # Function that stops the IDS instance and reports any error that
   495 # may occur while stopping.
   496 #
   497 ids_stop() {
   498 	
   499 	ids_log info "caled ids_stop"
   500 
   501 	ids_status
   502 	stat=$?
   503 
   504 	case $stat in
   505 
   506         # IDS instance is not running - success stopping it.
   507         $OCF_NOT_RUNNING)
   508 			ids_log info "ids_stop: IDS instance is not running: $stat"
   509             rc=$OCF_SUCCESS;;
   510 
   511         # IDS instance is in an undefined state - exit with error.
   512         $OCF_ERR_GENERIC)
   513 			ids_log error "ids_stop: IDS instance in undefined state: $stat"
   514 			ids_debug
   515             rc=$OCF_ERR_GENERIC;;
   516 
   517         # IDS instance is running - try to stop it.
   518         $OCF_SUCCESS)
   519 			ids_log info "ids_stop: running 'onmode -kuy' now..."
   520 			onmode -kuy
   521 			stat=$?
   522 			ids_log info "ids_stop: done running 'onmode -kuy' now: $stat"
   523 
   524 			# The onmode command terminated successfully - check new state of the IDS instance.
   525 			if [ $stat -eq 0 ]; then
   526 				ids_status
   527                 stat=$?
   528                 # New state is: not running - success.
   529                 if [ $stat -eq $OCF_NOT_RUNNING ]; then
   530 					ids_log info "ids_stop: IDS instance successfully stopped: $stat"
   531                     rc=$OCF_SUCCESS
   532                 # New state is: running or even undefined - failure!
   533                 else
   534 					ids_log error "ids_stop: stopping IDS instance failed: $stat"
   535                     ids_debug
   536                     rc=$OCF_ERR_GENERIC
   537                 fi
   538 				
   539  			# The onmode command terminated with an error - stopping the IDS resource failed!
   540             else
   541 				ids_log error "ids_stop: stopping IDS instance (by executing 'onmode -kuy') failed: $stat"
   542                 ids_debug
   543                 rc=$OCF_ERR_GENERIC
   544             fi
   545             ;;
   546 
   547 		# Unexpected state - return OCF_ERR_UNIMPLEMENTED error.
   548         *)
   549 			ids_log error "ids_stop: unexpected state returned from ids_status: $stat"
   550 			ids_debug
   551             rc=$OCF_ERR_UNIMPLEMENTED;;
   552 		
   553 	esac
   554 
   555 	# Return exit status code indicating whether IDS was successfully stopped or not.
   556 	return $rc
   557 }
   558 
   559 
   560 #
   561 # Function that determines the current status/state of the IDS instance,
   562 # meaning whether it is running (the case when output of "onstat -" contains "On-Line"),
   563 # not running (the case when output of "onstat -" contains "shared memory not initialized")
   564 # or in an undefined state (the case output of "onstat -" contains "Quiescent", "Single-User", or other).
   565 # If the IDS instance is declared running the exit status code will indicate succes, otherwise failure of course.
   566 #
   567 ids_status() {
   568 	
   569 	ids_log info "called ids_status"
   570 
   571 	# Get current status from the onstat tool and store it.
   572 	stat=`onstat -`
   573 	
   574 	case $stat in
   575 		
   576 		# IDS instance is running.
   577 		*"On-Line"*)
   578 			ids_log info "ids_status: IDS instance running: $stat"
   579 			rc=$OCF_SUCCESS;;
   580 
   581 		# IDS instance is not running.
   582 		*"shared memory not initialized"*)
   583 			ids_log info "ids_status: IDS instance not running: $stat"