1、创建文件

# vi /etc/systemd/system/tomcat.service

[Unit]
Description=Tomcat8540
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=oneshot
ExecStart=/usr/local/apache-tomcat-8.5.40/bin/startup.sh
ExecStop=/usr/local/apache-tomcat-8.5.40/bin/shutdown.sh
ExecReload=/bin/kill -s HUP $MAINPID
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

2、进入目录

# cd /etc/systemd/system/

3、设置开机启动

# systemctl enable tomcat

查询当前tomcat的状态:

# systemctl status tomcat

关闭tomcat:

# systemctl stop tomcat

关闭开机自启:

# systemctl disable tomcat

 

相关文章:

  • 2021-05-08
  • 2021-06-01
  • 2022-01-02
  • 2021-08-05
  • 2022-01-26
  • 2021-09-26
  • 2022-03-02
  • 2021-09-06
猜你喜欢
  • 2021-11-09
  • 2021-08-27
  • 2021-05-30
  • 2021-06-15
  • 2021-08-12
  • 2021-08-19
  • 2021-11-23
相关资源
相似解决方案