-
-
Save russellhoff/d6e804fb21486ad23e4d6ce710e0842e to your computer and use it in GitHub Desktop.
tomcat systemd service script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Systemd unit file for tomcat | |
[Unit] | |
Description=Apache Tomcat Web Application Container | |
After=syslog.target network.target | |
[Service] | |
Type=forking | |
ExecStart=/opt/apache-tomcat-8.5.23/bin/catalina.sh start | |
ExecStop=/opt/apache-tomcat-8.5.23/bin/catalina.sh stop | |
User=tomcat | |
Group=tomcat | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create tomcat's user (select a password):
$ sudo adduser tomcat
Edit ~/.bashrc file and append the following line at the bottom (replace the directory with yours):
export CATALINA_HOME="/opt/apache-tomcat-8.5.23"
Edit the current file
$ sudo vim /etc/systemd/system/tomcat.service
Reload systemd service daemons:
$ sudo systemctl daemon-reload
Enable service:
$ sudo systemctl enable tomcat.service Created symlink /etc/systemd/system/multi-user.target.wants/tomcat.service → /etc/systemd/system/tomcat.service.
Start service by typing:
$ sudo systemctl start tomcat.service
Stop service by typing:
$ sudo systemctl stop tomcat.service