日期:2014-05-16 浏览次数:20772 次
# !/bin/bash # Description: start or stop the tomcat # Usage: tomcat [start|stop|reload|restart] # export PATH=$PATH:$HOME/bin export BASH_ENV=$HOME/.bashrc export USERNAME="root" case "$1" in start) #startup the tomcat echo -n "tomcat start: " cd /home/tomcat-bdcServer/bin ./startup.sh echo " Tomcat 已启动" tail -f /home/tomcat-bdcServer/logs/log.log#打印日志 ;; stop) # stop tomcat echo -n "tomcat stop:" ps -ef | grep "java" | grep -v grep | sed 's/ [ ]*/:/g'|cut -d: -f2| kill -9 `cat` cd /usr/local/tomcat6/work rm -rf Catalina echo "Tomcat 已停止" ;; reload|restart) $0 stop $0 start ;; *) echo "用法: tomcat [start|stop|reload|restart]" exit 1 esac exit 0
chmod +x /etc/init.d/tomcat
1.[root@localhost]# cd /usr/bin 2. [root@localhost]# ln -s /etc/init.d/tomcat .