1.配置 tomcat 开机启动
创建 服务名xxxxxx.service文件,编辑之后保存即可
cd /usr/lib/systemd/system vi xxxxxx.service
插入以下内容
[Unit] Description=Tomcat After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=oneshot ExecStart=/usr/local/tomcat/apache-tomcat-9.0.80/bin/startup.sh ExecStop=/usr/local/tomcat/apache-tomcat-9.0.80/bin/shutdown.sh ExecReload=/bin/kill -s HUP $MAINPID RemainAfterExit=yes [Install] WantedBy=multi-user.target
保存文件,再执行 systemctl enable tomcat.service 命令使tomcat开机启动
systemctl enable tomcat.service # tomcat.service为刚才创建的文件名
其它相关命令
systemctl start tomcat.service # 启动tomcat systemctl stop tomcat.service # 关闭tomcat systemctl restart tomcat.service # 重启tomcat
启动和结束tomcat也可以到tomcat的安装目录的bin目录下执行shutdown.sh startup.sh来完成
2.配置 tomcat 开机启动-方法二(不推荐)
修改rc.local文件
标签:bin,tomcat,service,CentOS7,systemctl,开机,Tomcat9,target From: https://www.cnblogs.com/ershoushouji/p/17700380.html