Sei sulla pagina 1di 5

################################################################################ #### # SCRIPT: webmenu.

sh # # AUTHOR: Shreyas Shetty # # DESCRIPTION: # This Script is used to START , STOP and Clear CACHE for PeopleSoft Webserver P T850 and later # It even shows the status Webserver # This script is built PeopleSoft weblogic webserver with single server domain r unning on PT50 tool version #This Script is tested on Red hat linux Operating system # NOTE : THIS WILL MOVE the PIA_stdout.log log file with the current time stamp to create new file # ################################################################################ ##### export PS_HOME= export DOMAIN=peoplesoft /webserv/<> export PORT=8080 export SITENAME=ps export export export export export export export export export EN='\033[00m' RE='\033[01;31m' GR='\033[01;32m' YE='\033[01;33m' PU='\033[01;35m' CY='\033[01;36m' WH='\033[01;37m' BO='\033[1m' UL='\033[4m' #Path of the PSHOME #DOMAIN that you want to control <$PS_HOME #Port Number webserver is Running on #site Name for you PeopleSoft Webserver

line() { echo -e "${BO}--------------------------------------------${EN}" } lineR() { echo -e "${BO}${RE}--------------------------------------------${EN}" } space() { echo " " } space2() { space space } start() { DATE=`date '+%Y%m%d_%H%M%S'` RUN=0

ERR=0 STA=0 RES=0 STB=0 STATUS=`netstat -ano|grep $PORT| grep LISTEN |grep -v grep |awk '{print$9}'|w c -l` if [[ $STATUS -gt 1 || $STATUS -eq 1 ]] then echo " " echo " " echo -e "${YE}$DOMAIN PIA IS already UP and RUNNING${EN}" echo " " echo " " else mv $PS_CFG_HOME/webserv/$DOMAIN/servers/PIA/logs/PIA_stdout.log $PS_HOME/we bserv/$DOMAIN/servers/PIA/logs/PIA_stdout.$DATE sh $PS_CFG_HOME/webserv/$DOMAIN/bin/startPIA.sh space echo -e "${YE}Please wait ....${EN}" while [[ $RUN -eq 0 ]] ; do [ "`grep -c "Server started in RUNNING mode" $PS_CFG_HOME/webserv/$DOMAIN /servers/PIA/logs/PIA_stdout.log`" -gt "0" ] && RUN=1; if [ $STB -eq 0 ] then [ "`grep -c "Server state changed to STANDBY" $PS_CFG_HOME/webserv/$DOM AIN/servers/PIA/logs/PIA_stdout.log`" -gt "0" ] && STB=1; else if [ $STB -eq 1 ] then echo -e "PIA Status Changed To ${GR}STANDBY${EN}" STB=2 fi fi if [ $STA -eq 0 ] then [ "`grep -c "Server state changed to STARTING" $PS_HOME/webserv/$DOMAIN /servers/PIA/logs/PIA_stdout.log`" -gt "0" ] && STA=1; else if [ $STA -eq 1 ] then echo -e "PIA Status Changed To ${GR}STARTING${EN}" STA=2 fi fi if [ $RES -eq 0 ] then [ "`grep -c "Server state changed to RESUMING" $PS_CFG_HOME/webserv/$DOM AIN/servers/PIA/logs/PIA_stdout.log`" -gt "0" ] && RES=1; else if [ $RES -eq 1 ] then echo -e "PIA Status Changed To ${GR}RESUMING${EN}" RES=2 fi fi

if [ $ERR -eq 0 ] then [ "`grep -c "Server state changed to FORCE_SHUTTING_DOWN" $PS_CFG_HOME/we bserv/$DOMAIN/servers/PIA/logs/PIA_stdout.log`" -gt "0" ] && ERR=1; else break fi done

if [ $RUN -eq 1 ] then space2 echo -e "${BO}$DOMAIN PIA is ${GR}UP and RUNNING${EN} ${BO}now${EN}" space2 fi if [ $ERR -eq 1 ] then space2 echo -e "${BO}${RE}****ERROR****${EN} : ${BO}$DOMAIN PIA is ${YE}FORCE_SH UTTING_DOWN ${RE}!!!!!!!! ${EN}" space2 echo -e "${BO}Do You Want To Check Logs?${EN}" while : do echo -e -n "${BO}Please Choose [${GR}Y${EN}${BO}/${GR}N${EN}] ${EN}:" read opt case $opt in y|Y)space lineR tail -n 20 $PS_CFG_HOME/webserv/$DOMAIN/servers/PIA/logs/PIA_st dout.log lineR space break;; n|N)space break;; *) esac done fi fi } stop() { sh $PS_CFG_HOME/webserv/$DOMAIN/bin/stopPIA.sh echo " " echo " " } clearsh() { STATUS=`netstat -ano|grep $PORT| grep LISTEN |grep -v grep |awk '{print$9}'|wc l` if [[ $STATUS -gt 1 || $STATUS -eq 1 ]]

then echo " " echo -e "${RE}Please bring DOWN PIA before clearing Cache${EN}" echo else rm -rf $PS_CFG_HOME/webserv/$DOMAIN/applications/peoplesoft/PORTAL.war/$SITE NAME/cache/* echo " " echo -e "${YE}Webserver Cache for $DOMAIN is cleared${EN}" echo " " fi } config() { vi $PS_CFG_HOME/webserv/$DOMAIN/applications/peoplesoft/PORTAL.war/WEB-INF/ps ftdocs/$SITENAME/configuration.properties } while : do clear line echo -e " ${BO}${YE}$DOMAIN${EN} ${BO}WEBSERVER MENU${EN}" line space STATUS=`netstat -ano|grep $PORT| grep LISTEN |grep -v grep |awk '{print$9}'|wc -l` if [[ $STATUS -gt 1 || $STATUS -eq 1 ]] then echo -e "${BO}PIA STATUS : ${BO}${GR}RUNNING${EN}" else echo -e "${BO}PIA STATUS : ${RE}${BO}DOWN !!!${EN}" fi echo "" echo "1. START PIA" echo "2. STOP PIA" echo "3. ClEAR CACHE" echo "4. CONFIGURATION" echo "q. EXIT" echo " " echo -e -n "${BO}Please enter option ${GR}[1 - 4]${EN} ${BO}:${EN} " read opt case $opt in q|Q) break;; 1) start; echo -e "${BO}Press ${GR}[enter]${EN} ${BO}key to continue. . .${EN}"; read enterKey;; 2) stop; echo -e "${BO}Press ${GR}[enter]${EN} ${BO}key to continue. . .${EN}"; read enterKey;; 3) clearsh; echo -e "${BO}Press ${GR}[enter]${EN} ${BO}key to continue. . .${EN}"; read enterKey;; 4) config; echo -e "${BO}Press ${GR}[enter]${EN} ${BO}key to continue. . .${EN}"; read enterKey;; *) echo -e "${YE}oops!!! $opt is an invaild option. Please select option betwe en 1-2 only or 'q' to exit${EN}"; echo -e "${BO}Press ${GR}[enter]${EN} ${BO}key to continue. . .${EN}";

read enterKey;; esac done

Potrebbero piacerti anche