Monday, November 16, 2015

To Start tomcat in Linux through shell script

SHUTDOWN_WAIT=30
TOMCAT_HOME=/opt/BigDinosaur/tomcat
tomcat_pid() {
  echo `ps aux | grep org.apache.catalina.startup.Bootstrap | grep -v grep | awk '{ print $2 }'`
}

start() {


  pid=$(tomcat_pid)
  if [ -n "$pid" ]
  then
    echo "Tomcat is already running (pid: $pid)"
  else
    # Start tomcat
    echo "Starting tomcat"
       umask 007
     $TOMCAT_HOME/bin/startup.sh
  fi


  return 0
}

case $1 in
start)
  start
;;

save it in file bddeploy.sh

To execute issue following command
sh bddeploy.sh start

No comments:

Post a Comment