Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
rb:restartplatform [14/06/2011 12:31]
andrew created
rb:restartplatform [10/10/2013 15:21] (current)
Line 1: Line 1:
 ====== Restart Platform ====== ====== Restart Platform ======
  
-#​!/​bin/​bash +  ​#​!/​bin/​bash 
-#Restart Platform WL Process Daily - DK +  #Restart Platform WL Process Daily - DK 
-#modified Andrew Stringer, 04/01/2011 to only send mail in case of failure +  #modified Andrew Stringer, 04/01/2011 to only send mail in case of failure 
- +   
-#Set Up Script Variables +  #Set Up Script Variables 
- +   
-HOST=`hostname` +  HOST=`hostname` 
-DATE=`date` +  DATE=`date` 
-LOG=/​tmp/​`hostname`-wlrestart.log +  LOG=/​tmp/​`hostname`-wlrestart.log 
-MAIL=ww-noc@igt.com +  MAIL=xx-noc@zzz.com 
-SCRIPT1=/​wworks/​rgs/​weblogic/​prod/​bin/​weblogic.platform.managed +  SCRIPT1=/​wworks/​rgs/​weblogic/​prod/​bin/​weblogic.platform.managed 
-SCRIPT1OPT=restart +  SCRIPT1OPT=restart 
-WLLOGDIR=/​wworks/​rgs/​weblogic/​prod/​logs/​ +  WLLOGDIR=/​wworks/​rgs/​weblogic/​prod/​logs/​ 
-WLPLATLOG=platform-prod-managed-04.log +  WLPLATLOG=platform-prod-managed-04.log 
-SLEEPWAIT=180 +  SLEEPWAIT=180 
-READLINES=400 +  READLINES=400 
- +   
- +   
-#Run external restart script +  #Run external restart script 
-echo "​Running ${SCRIPT1} ${SCRIPT1OPT}"​ >> ${LOG} +  echo "​Running ${SCRIPT1} ${SCRIPT1OPT}"​ >> ${LOG} 
-${SCRIPT1} ${SCRIPT1OPT} > ${LOG} +  ${SCRIPT1} ${SCRIPT1OPT} > ${LOG} 
- +   
-#Wait for server to shut down +  #Wait for server to shut down 
-sleep ${SLEEPWAIT} +  sleep ${SLEEPWAIT} 
- +   
-tail -${READLINES} ${WLLOGDIR}${WLPLATLOG} | grep -i "​Server started in RUNNING mode" >> ${LOG} +  tail -${READLINES} ${WLLOGDIR}${WLPLATLOG} | grep -i "​Server started in RUNNING mode" >> ${LOG} 
-RESULT=$? +  RESULT=$? 
- +   
- +   
-if [ ${RESULT} != 0 ] +  if [ ${RESULT} != 0 ] 
-        then +          then 
-        #This gets run if the logs don't show the magic phrase "​Server started in RUNNING mode"​ +          #This gets run if the logs don't show the magic phrase "​Server started in RUNNING mode"​ 
-        echo " " >> ${LOG} +          echo " " >> ${LOG} 
-        echo "​Server ${HOST} does not appear to have started correctly"​ >> ${LOG} +          echo "​Server ${HOST} does not appear to have started correctly"​ >> ${LOG} 
-        echo " " ​ >> ${LOG} +          echo " " ​ >> ${LOG} 
-        echo "From /​home/​wworks/​ops/​restart_platform.sh on ${HOST}"​ >> $LOG +          echo "From /​home/​wworks/​ops/​restart_platform.sh on ${HOST}"​ >> $LOG 
-        echo " " >> ${LOG} +          echo " " >> ${LOG} 
- +   
-        #Mail Out +          #Mail Out 
-        echo "​Sending notification mail.."​ >> ${LOG} +          echo "​Sending notification mail.."​ >> ${LOG} 
-        mail ${MAIL} -s "​${HOST} - RGS Managed Restart @ ${DATE}"​ < ${LOG} +          mail ${MAIL} -s "​${HOST} - RGS Managed Restart @ ${DATE}"​ < ${LOG} 
- +   
-        exit 1 +          exit 1 
- +   
- +   
-else +  else 
-        # $RESULT is 0, so this gets run if the server has started normally. +          # $RESULT is 0, so this gets run if the server has started normally. 
-        #In this case, an email should not be sent, hence commented out lines for mail sending +          #In this case, an email should not be sent, hence commented out lines for mail sending 
-        echo " " >> ${LOG} +          echo " " >> ${LOG} 
-        echo "​Server started in RUNNING mode" >> ${LOG} +          echo "​Server started in RUNNING mode" >> ${LOG} 
-        echo " " >> ${LOG} +          echo " " >> ${LOG} 
-        echo "From /​home/​wworks/​ops/​restart_platform.sh on ${HOST}"​ >> $LOG +          echo "From /​home/​wworks/​ops/​restart_platform.sh on ${HOST}"​ >> $LOG 
-        echo " " >> ${LOG} +          echo " " >> ${LOG} 
- +   
-        #Mail Out +          #Mail Out 
-        echo "​Sending notification mail.."​ >> ${LOG} +          echo "​Sending notification mail.."​ >> ${LOG} 
-        #mail ${MAIL} -s "​${HOST} - RGS Managed Restart @ ${DATE}"​ < ${LOG} +          #mail ${MAIL} -s "​${HOST} - RGS Managed Restart @ ${DATE}"​ < ${LOG} 
-fi +  fi 
- +   
-#Done +  #Done 
-exit 0+  exit 0
  

rb/restartplatform.txt · Last modified: 10/10/2013 15:21 (external edit)