首页 电脑 电脑学堂 查看内容

tomcat 自启动脚本

2011-5-6 14:17 522 0

摘要:   #!/bin/bash  # chkconfig: 2345 10 90  # description: Start and Stop the Tomcat daemon.  TOMCAT_HOM...
关键词: Tomcat Start echo Stop HOME CATALINA status networking startup restart

  #!/bin/bash  # chkconfig: 2345 10 90  # description: Start and Stop the Tomcat daemon.  TOMCAT_HOME=/opt/apache-tomcat-6.0.29  TOMCAT_START=$TOMCAT_HOME/bin/startup.sh  TOMCAT_STOP=$TOMCAT_HOME/bin/shutdown.sh  # necessary environment variables export  CATALINA_HOME=$TOMCAT_HOME  export JAVA_HOME=/usr/java/jdk1.6.0_21  # source function library.  . /etc/rc.d/init.d/functions  # source networking configuration.  . /etc/sysconfig/network  # check that networking is up.  [ "${NETWORKING}" = "no" ] && exit 0  # check for tomcat script  if [ ! -f $TOMCAT_HOME/bin/catalina.sh ]  then echo "Tomcat not valilable..."  exit  fi  start(){  echo -n "Starting Tomcat: "  daemon $TOMCAT_START  echo  touch /var/lock/subsys/tomcat  }  stop(){  echo -n $"Shutting down Tomcat: "  daemon $TOMCAT_STOP  rm -f /var/lock/subsys/tomcat.pid echo  }  restart(){  stop  start  }  status(){  ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" | awk '{printf $1 " "}' | wc | awk '{print $2}' > /tmp/tomcat_process_count.txt  read line < /tmp/tomcat_process_count.txt  if [ $line -gt 0 ]; then  echo -n "tomcat ( pid "  ps ax --width=1000 | grep "org.apache.catalina.startup.Bootstrap start" | awk '{printf $1 " "}'  echo -n ") is running..."  echo  else  echo "Tomcat is stopped"  fi  }  case "$1" in  start)  start ;;  stop)  stop ;;  restart)  stop  sleep 3  start ;;  status)  status ;;  *)  echo "Usage: tomcatd {start|stop|restart|status}"  exit 1  esac  exit 0
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部