1. vi/etc/init.d/tomcat7,
Add below segment to the file, replace the ones marked in red by your tomcat installed path.
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
case $1 in
start)
sh /usr/share/tomcat7/bin/startup.sh
;;
stop)
sh /usr/share/tomcat7/bin/shutdown.sh
;;
restart)
sh /usr/share/tomcat7/bin/shutdown.sh
sh /usr/share/tomcat7/bin/startup.sh
;;
esac
exit 0
2. Add the autostart service to your server
sudo chmod 755 /etc/init.d/tomcat7
sudo update -rc.d tomca7 defaults
3. Restart your server
本文指导您如何在服务器上配置Tomcat自动启动服务,包括编辑启动脚本、赋予执行权限、设置默认启动项和重启服务器等步骤。
189

被折叠的 条评论
为什么被折叠?



