top of page

START_STOP_SCRIPT(method-start_stop.sh)

  • Fredrick Were
  • Sep 22, 2018
  • 2 min read

###################################################################################################################### #!/bin/bash ################################################################## #program : method_webcache_start_stop_script.sh ################################################################## # chkconfig: 345 20 10 # Startup and Shutdown Documentum # Oracle database must be started BEFORE starting Documentum

###########################################################################################

set -x EXPLORE_SHARE="`ls /app/documentum| grep -E 'share|xPlore'`" JBOSSQUERY="`ls /app/documentum/$EXPLORE_SHARE/ | grep -E 'jboss|wildfly' | grep -v old | sort -rg |awk 'FNR==1{print $1}'`" JBOSS_DIR="/app/documentum/$EXPLORE_SHARE/$JBOSSQUERY" #---------------------------------------------------------------------------------------------------------------- METHODS_STARTUP_SCRIPT=`ls $JBOSS_DIR/server/ | grep -i start*Method*` METHODS_STOP_SCRIPT=`ls $JBOSS_DIR/server/ | grep -i stop*Method*`

#----------------------------------------------------------------------------------------------

WEBCACHE_STARTUP_SCRIPT="`ls $JBOSS_DIR/server/ | grep -i start*WEB*`" WEBCACHE_STOP_SCRIPT="`ls $JBOSS_DIR/server/ | grep -i stop*WEB*`" #################################################################################################################

start() { echo "Starting method Service"

cd $JBOSS_DIR/server; mv nohup.out nohup.bak

if [[ -z "$METHODS_STARTUP_SCRIPT" ]] 2>/dev/null; then

echo "Blank Missing methods Script";

else

echo "Method Script Found Restarting Method Process " cd $JBOSS_DIR/server; nohup ./$METHODS_STARTUP_SCRIPT & echo "OK : Methods Process Restarting" sleep 15;

if [ $(ps -ef | grep -i method| grep -v grep | wc -l) -ge 2 ]; then echo "Method Status = [ OK ] "; else echo "Method Status = [ WARNING ]"; fi fi

echo "*********************************************************" echo "Starting Webcache Server "

if [[ -z "$WEBCACHE_STARTUP_SCRIPT" ]] 2>/dev/null; then echo "Webcache script missing Nothing to do" echo "Skipping to next script" else

echo "Webscript files Exist ...Restarting Webcache process " cd $JBOSS_DIR/server; nohup ./$WEBCACHE_STARTUP_SCRIPT & echo "OK: Webcache service is Restarting" sleep 15; if [ $(ps -ef | grep -i webcache| grep -v grep | wc -l) -ge 2 ]; then echo "Webcache Status = [ OK ] "; else echo "Webcache Status = [ WARNING ]"; fi fi

}

stop() {

echo "Stopping documentum Webcache & methods Process " echo "Shutting down webcache process....." echo "**************************************************"

if [[ -z "$WEBCACHE_STOP_SCRIPT" ]] 2>/dev/null; then echo "EMPTY String Webcache script missing.... skipping ............" else

echo "Webcache script exist...Stopping Webcache Service Now "; cd $JBOSS_DIR/server; ./$WEBCACHE_STOP_SCRIPT echo "OK:" echo "OK: Webcache service is Stopping ************ "; sleep 15; if [ $(ps -ef | grep -i Webcache| grep -v grep | wc -l) -ge 2 ]; then echo "Webcache Stopping_Status = [ WARNING ] "; else echo "Webcache Stopping_Status = [ SUCCESSFUL ]"; fi fi

echo "Stopping Method Service" echo "************************************************************"

if [[ -z "$METHODS_STOP_SCRIPT" ]] 2>/dev/null; then echo "Empty String Method script missing ... skipping ....."

else echo "Methods script exist Stopping method process Now ..."; cd $JBOSS_DIR/server; ./$METHODS_STOP_SCRIPT echo "OK: Methods is Stopping ************" sleep 15; if [ $(ps -ef | grep -i Methods| grep -v grep | wc -l) -ge 2 ]; then echo "Method Stopping_Status = [ WARNING ] "; else echo "Method Stopping_Status = [ SUCCESSFUL ]"; fi

fi

}

case "$1" in start) start ;; stop) stop ;;

reload|restart) $0 stop $0 start ;; *) #echo "Usage: /etc/init.d/tornado-tts {start|stop|restart}" echo "Usage: $0 start|stop|restart|reload" exit 1 esac exit 0

 
 
 

Commentaires


©2018 by OPEN LINUX LEARNING. Proudly created with Wix.com

bottom of page