You can add custom components to CRS if you have a need. You basically need a program (perhaps as simple as a shell script) that accepts three command line arguments:
- start
- stop
- check
Below is an example of a shell script that you can register.
#!/bin/sh
if [ "$1" = "start" ]; then
/home/oracle/test &
elif [ "$1" = "stop" ]; then
PID=$(ps -ef | grep "/home/oracle/test" | grep -v grep | awk '{print $2}')
if [ $PID ]; then
kill -9 $PID
fi
exit 0
elif [ "$1" = "check" ]; then
ps -ef | grep "/home/oracle/test" | grep -v grep | grep -v check > /dev/null
RETURN=$?
exit $RETURN
fi
…with the program below called by the script above…
#!/bin/sh
while true; do
echo 1
sleep 5
done
You can then register the program by creating the following resource profile in a file named oclc.linux1.test.cap in the current directory…
NAME=oclc.linux1.test TYPE=application ACTION_SCRIPT=/home/oracle/test.sh ACTIVE_PLACEMENT=0 AUTO_START=1 CHECK_INTERVAL=30 DESCRIPTION=test application FAILOVER_DELAY=0 FAILURE_INTERVAL=0 FAILURE_THRESHOLD=0 HOSTING_MEMBERS=linux1 OPTIONAL_RESOURCES= PLACEMENT=restricted RESTART_ATTEMPTS=20 SCRIPT_TIMEOUT=30 START_TIMEOUT=0 STOP_TIMEOUT=0 UPTIME_THRESHOLD=7d
…which you finally register with the clusterware as follows…
crs_register oclc.linux1.test -dir $(pwd)