发布网友 发布时间:2022-04-22 06:37
共1个回答
热心网友 时间:2023-10-18 17:11
1、建立启动脚本(/etc/init.d/tomcat)
#
# !/bin/bash
# Description: start or stop the tomcat
# Usage: tomcat [start|stop|reload|restart]
# Author: Wang Yinghui
# Date: Thu Apr 26, 2007
#
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-5.5.20/bin/
. myconfig.sh
./startup.sh
cd /home/tomcat-5.5.20_second
. myconfig.sh
./startup.sh
echo "finished"
;;
stop)
# stop tomcat
echo -n "tomcat stop:"
ps -ef | grep "java" | grep -v grep | sed 's/ [ ]*/:/g'|cut -d: -f2| kill -9 `cat`
echo "finished"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: tomcat [start|stop|reload|restart]"
exit 1
esac
exit 0