Community

Daemon to check if SMO is running... if it's not, it will start SMO

Hi All,

 

This is neto from Brazil

 

How are you?

 

Captain Nascimento (https://twitter.com/@rodrigontap) and neto from Brazil (https://twitter.com/@netofrombrazil) have developed some sample scripts to demonstrate how to have a daemon script to check if SMO is running... If it is not running, it will start SMO.

 

#!/bin/bash

# smo-check --- Checking if SMO and SDU are running

#

# version 1.0

# by neto from Brazil   - @netofrombrazil

#    Rodrigo Nascimento - @rodrigontap

 

function startall() {

export count=`ps auxwww | grep "java -Xmx128m -XX:+HeapDumpOnOutOfMemoryError -enableassertions -cp /opt/NetApp/smo/webapp/WEB-INF/lib/smo/smo.jar com.netapp.dlm.ui.cli.SMOServerCLI start" | grep -v grep | wc -l`

if  [ "$count" == "0" ]; then

          smo_server start > /dev/null 2>&1

fi

}

 

terminatorFile="/home/oracle/.killchecksmo"

while true; do

          startall;

          if [ -f "$terminatorFile" ];

        then 

            export state=`ps auxwww | grep $$ | grep -v grep | awk '{ print $8 }'`

          export pid=$$

            trap 'exit 0' TERM

            exec 3>&2

            exec 2> /dev/null

          kill $pid >/dev/null 2>&1

            sleep 1

            exec 2>&3

             exec 3>&-

          fi

sleep 1

done

 

To run:

nohup ./smo-check.sh &

 

if you want to stop the daemon, please do: touch /home/oracle/.killchecksmo

 

All the best

 

neto

NetApp - I love this company!

Comments
on ‎2014-08-01 03:42 AM

Hey great man, this is what I was searching for.