原文地址:https://blog.csdn.net/JEYMING/article/details/83308068

编写配置文件

// (1)修改tomcat.service
vim /lib/systemd/system/tomcat.service

// (2)复制以下代码,注意修改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

启动服务

systemctl start tomcat.service

查看服务状态

systemctl status tomcat.service

设置开机启动

systemctl enable tomcat.service

重启测试

reboot

 

相关文章:

  • 2021-10-27
  • 2022-12-23
  • 2021-11-28
  • 2021-10-11
  • 2021-11-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-04
  • 2021-11-20
  • 2021-07-07
  • 2022-12-23
相关资源
相似解决方案