centos7 tomcat service 自启动
第一步:
vim /lib/systemd/system/tomcat.service
第二步:复制以下代码保存退出,注意修改你的tomcat路径
[Unit]
Description=tomcat
After=network.target
[Service]
Type=oneshot
ExecStart=/home/apache-tomcat-7.0.70/bin/startup.sh //自已的tomcat目录
ExecStop=/home/apache-tomcat-7.0.70/bin/shutdown.sh
ExecReload=/bin/kill -s HUP $MAINPID
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
第三步:启动服务
systemctl start tomcat.service
第四步:查看服务状态
systemctl status tomcat.service
第五步:开机启动
systemctl enable tomcat.service
重启之后再查看服务状态已经启动。
转自:http://www.cnblogs.com/cosiray/p/5294750.html
本文介绍如何在CentOS 7中配置Tomcat服务实现自启动。主要包括编辑tomcat.service文件、设置启动脚本和服务管理命令等内容。
2921

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



