centos7 tomcat开机自启

操作系统centos7.*:

vim /lib/systemd/system/tomcat.service

[Unit]

Description=tomcat

After=network.target

[Service]

Type=oneshot

ExecStart=/test/tomcat/bin/startup.sh //自已的tomcat目录

ExecStop=/test/tomcat/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

你可能感兴趣的:(tomcat,linux,centos)