日期:2014-05-16 浏览次数:20694 次
# !/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 /usr/local/tomcat6/bin/ ./startup.sh echo " Tomcat start finished" ;; 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 "finished" ;; reload|restart) $0 stop $0 start ;; *) echo "Usage: tomcat [start|stop|reload|restart]" exit 1 esac exit 0
[root@localhost]# chmod +x /etc/init.d/tomcat
[root@localhost]# cd /usr/bin [root@localhost]# ln -s /etc/init.d/tomcat .