原文地址: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