Setting tomcat8 as system services on Centos7

The following methods are effective for me. Here’s how I did it.
* I’m operating in /home/robin

1. Extracting “tomcat*.tar.gz” to /home/robin

2. Typeing command: vim /home/robin/tomcat*/bin/catalina.sh

JAVA_HOME=/opt/jdk1.8.0_202
JRE_HOME=$JAVA_HOME/jre

Adding above in from of “# OS specific support.”(
Note the Java installation directory )

catalina.sh

3. Modifiying “/usr/lib/systemd/system/tomcat.service” (You can change it to any name you like. e.g. mytomcat.service, mycommand.service and so on. )

Typeing:

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

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

[Install]
WantedBy=multi-user.target

4. Allow start-up

systemctl enable tomcat

5. Commond of Tomcat

systemctl start tomcat.service
systemctl status tomcat.service
systemctl restart tomcat.service
systemctl stop tomcat.service

The original link: https://www.cnblogs.com/wycfm/p/9595550.html