인디노트

tomcat service 실행 스크립트 본문

개발 플랫폼 및 언어

tomcat service 실행 스크립트

인디개발자 2018. 3. 10. 10:39


#!/bin/sh

#

# /etc/init.d/tomcat

# chkconfig: 234 20 80

# This is the init script for starting up the

#  Jakarta Tomcat server

#

# description: Starts and stops the Tomcat daemon.

#

PROG=tomcat

tomcat=/opt/entrust/adminservices/tomcat/apache-tomcat

startup="$tomcat/bin/catalina.sh start"

shutdown="$tomcat/bin/catalina.sh stop"


start() {

  echo -n $"Starting Tomcat service: "

  /bin/su -s /bin/bash root $startup

  echo $?

}


stop() {

  echo -n $"Stopping Tomcat service: "

  /bin/su -s /bin/bash root $shutdown

  echo $?

}


restart() {

  stop

  start

}


status() {

  PID=`/bin/ps -aef |/bin/grep 'catalina.startup.Bootstrap'|/bin/grep -v grep|/bin/awk '{print $2}'`

  if [ "$PID" = "" ]; then

  echo "$PROG is down"

  else

  echo "$PROG[pid=$PID] is running"

  fi

}


# Handle the different input options

case "$1" in

start)

  start

  ;;

stop)

  stop

  ;;

status)

  status

  ;;

restart)

  restart

  ;;

*)

  echo $"Usage: $0 {start|stop|restart|status}"

  exit 1

esac


exit 0



반응형
Comments