1:首先安装自启动管理工具
apt-get install sysv-rc-conf
2:追加Tomcat启动脚本
比如A服务需要启动三个Tomcat,则创建Tomcat-A的脚本文件,并放置到/etc/init.d/下,
注意文件权限设置为755。脚本内容如下:
export JAVA_HOME=/usr/lib/jvm/default-java
case $1 in
start)
sh /usr/local/tomcat/A/1/bin/startup.sh
sh /usr/local/tomcat/A/2/bin/startup.sh
sh /usr/local/tomcat/A/3/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/A/1/bin/shutdown.sh
sh /usr/local/tomcat/A/2/bin/shutdown.sh
sh /usr/local/tomcat/A/3/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/A/1/bin/shutdown.sh
sh /usr/local/tomcat/A/2/bin/shutdown.sh
sh /usr/local/tomcat/A/3/bin/shutdown.sh
sh /usr/local/tomcat/A/1/bin/startup.sh
sh /usr/local/tomcat/A/2/bin/startup.sh
sh /usr/local/tomcat/A/3/bin/startup.sh
;;
esac
exit 0
3: 执行自启动命令
sysv-rc-conf tomcat-A on
4: 重新启动
posted on 2009-08-06 17:54
蓝剑 阅读(2400)
评论(1) 编辑 收藏 所属分类:
WebServer