tomcat启动脚本

4880阅读 0评论2012-02-22 yl1003
分类:Python/Ruby

下面是脚本:
  1. #!/bin/bash

  2. #startup script for tomcat on linux

  3. #filename tomcat1.sh


  4. JAVA_HOME=/usr/java/jdk1.6.0_31
  5. TOMCAT1_HOME=/usr/local/tomcat1

  6. ################################################

  7. start_tomcat=$TOMCAT1_HOME/bin/startup.sh
  8. stop_tomcat=$TOMCAT1_HOME/bin/shutdown.sh

  9. start() {
  10.     echo -n "Starting tomcat1: "
  11.     ${start_tomcat}
  12.     echo "tomcat1 start ok"
  13. }

  14. stop() {
  15.     echo -n "Shutdown tomcat1"
  16.     ${stop_tomcat}
  17.     echo "tomcat1 stop ok"
  18. }

  19. #how we were called

  20. case "$1" in
  21.     start)
  22.         start
  23.         ;;
  24.     stop)
  25.         stop
  26.         ;;
  27.     restart)
  28.         stop
  29.         sleep 10
  30.         start
  31.         ;;
  32.     *)
  33.         echo "Usage: $0 {start|stop|restart}"
  34. esac

  35. exit 0
启动时的命令为:
sh tomcat1.sh start

上一篇:小结
下一篇:神奇的vi