[CentOS] Starting tomcat on bootup

Leandro Costa lscosta at uninet.com.br
Wed May 3 21:46:53 UTC 2006


#!/bin/sh
#
# tomcat:       Starts the Jakarta tomcat server
#
# Version:      @(#) /etc/init.d/tomcat 1.0
#
# chkconfig: 2345 55 45
# description: Starts and stops the Jakarta tomcat server at boot time 
and shutdown.
#
# processname: tomcat

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

start() {
   echo -n $"Starting tomcat: "
   su - tomcat -c '$CATALINA_HOME/bin/startup.sh'
   ret=$?
   [ $ret -eq 0 ] && (touch /var/lock/subsys/tomcat; echo_success)
   echo
   return $ret
}

stop() {
   echo -n $"Shutting down tomcat: "
   su - tomcat -c '$CATALINA_HOME/bin/shutdown.sh'
   ret=$?
   [ $ret -eq 0 ] && rm -f /var/lock/subsys/tomcat
   echo
   return $ret
}

rhstatus() {
   status tomcat
}

reload() {
   if [ -f /var/lock/subsys/tomcat ]; then
      echo -n $"Reloading tomcat: "
      killproc tomcat -USR1
      ret=$?
      echo
      return $ret
   else
      stop
      start
   fi
}

restart() {
   echo $"Restarting tomcat:"
   stop
   start
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
    restart
    ;;
  reload)
        reload
        ;;
  condrestart)
        [ -f /var/lock/subsys/tomcat ] && reload || :
        ;;
  status)
        rhstatus
        ;;
  *)
        echo $"*** Usage: tomcat 
{start|stop|status|restart|reload|condrestart}"
        exit 1
esac

exit $?

-- 
[ ]s,
LRU #391067
Analista de Rede
Leandro Costa
:wq
...... __@
...._ \ >_
...(_)/ (_)_________




More information about the CentOS mailing list