톰캣 자동 시작

Tags:

#!/bin/bash 

#   /etc/rc.d/init.d/tomcat 

# Starts the tomcat 


#   See how we were called. 

# Source function library. 
. /etc/init.d/functions 

prog=”tomcat” 
RETVAL=0 

start() { 
   # Check if tomcat is already running 
   if [ ! -f /var/lock/subsys/tomcat ]; then 
       echo -n $”Starting $prog: ” 
       daemon /usr/local/tomcat/bin/startup.sh 
       RETVAL=$? 
       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/tomcat 
       echo 
   fi 
   return $RETVAL 

stop() { 
   echo -n $”Stopping $prog: ” 
   /usr/local/tomcat/bin/shutdown.sh
   RETVAL=$? 
   [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/tomcat 
   echo 
       return $RETVAL 

restart() { 
   stop 
   start 

reload() { 
   restart 

status_at() { 
   : 

case “$1″ in 
start) 
   start 
   ;; 
stop) 
   stop 
   ;; 
reload|restart) 
   stop 
   [ $RETVAL -eq 0 ] && start 
   ;; 
status) 
   status_at 
   ;; 
*) 
   echo $”Usage: $0 {start|stop|restart|condrestart|status}” 
   exit 1 
esac 

exit $? 
exit $RETVAL 

시작 runlevel 3
종료 runlevel 2

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *