手机版
你好,游客 登录 注册
背景:
阅读新闻

Tomcat7在Ubuntu上自动启动

[日期:2012-06-11] 来源:Linux社区  作者:Linux [字体:大 中 小]

为了让Tomcat在Ubuntu上自动启动,当电脑重起时, 你必须添加一个脚本, 使其能自动启动或关闭tomcat

To make tomcat automatically start when we boot up the computer, you can add a script to make it auto-start and shutdown.

sudo gedit /etc/init.d/tomcat7

Now paste in the following:
添加下面文字

# Tomcat auto-start## description: Auto-starts tomcat# processname: tomcat# pidfile: /var/run/tomcat.pidcase $1 instart)sh /usr/share/tomcat7/bin/startup.sh;;stop) sh /usr/share/tomcat7/bin/shutdown.sh;;restart)sh /usr/share/tomcat7/bin/shutdown.shsh /usr/share/tomcat7/bin/startup.sh;;esac exit 0
修改权限使其执行
You’ll need to make the script executable by running the chmod command:

sudo chmod 755 /etc/init.d/tomcat7
最后一步就是创建一个链接文件在启动目录, 执行下面两条语句
The last step is actually linking this script to the startup folders with a symbolic link. Execute these two commands and we should be on our way.

sudo ln -s /etc/init.d/tomcat7 /etc/rc1.d/K99tomcatsudo ln -s /etc/init.d/tomcat7 /etc/rc2.d/S99tomcat

Tomcat should now be fully installed and operational. Enjoy!
这个时候TOMCAT应该是能运行了sudo /etc/init.d/tomcat7 restart

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款