The gadget spec URL could not be found

Script to notify SAP Java Server node restart.

Requirement : Notify by mail when any of the server node of SAP Java server restarts .

Please note : This script is for UNIX like Operating system , although same logic can be applied for any other OS. 

Server node of SAP Java system can restart  due to many reasons , it can be a Out Of Memory(OOM) error or any fatal error . SAP server node has a default property to restart in case of these situation. 
We have written this script to identify the situation where a server node is restarted.  

Why not URL availability monitor ?
You can use any monitoring tool to check the availability of your JAVA URL , but that tool will not detect the restart of server node . URL availability tool will not raise alert until you have at least one server node responding to URL ping. 

Logic : Whenever server node restart it is assigned a new process ID at OS level , our script will monitor the process ID change and send a mail when it happens.

Script : 
hostname:p1padm 27> cat /home/p1padm/notifyRestart.ksh


ps -ef | grep ${SID}adm | grep -i jlaunch | grep -v grep | awk '{print $2}' > ${SCRIPTDIR}/${CURR_PID}
PID_COUNT=`cat ${SCRIPTDIR}/${PREV_PID} ${SCRIPTDIR}/${CURR_PID} | sort | uniq -u | wc -l`

if [[ ${PID_COUNT} -gt 0 ]]
  echo "Server node process got restarted . Verify `echo ${SID} | tr [a-z] [A-Z]`." > ${SCRIPTDIR}/${MAIL_PID}
  echo >> ${SCRIPTDIR}/${MAIL_PID}
  ps -ef | grep ${SID}adm | grep -i jlaunch | grep -v grep >> ${SCRIPTDIR}/${MAIL_PID}
  cat ${SCRIPTDIR}/${MAIL_PID} | mailx -s "Server node process got restarted - `uname -n` (`echo ${SID} | tr [a-z] [A-Z]`)" ${MAILADM}

Change the highlighted parameters as per your system.
SAP JAVA Server Node restart notification script

How to run ?
Create a CRON entry to run this script every 2 min .

PS : This script is written for SAP JAVA version <  7.1 , for 7.1 or higher , change the script to look for jstart process instead of jlaunch.

The gadget spec URL could not be found
The gadget spec URL could not be found