Difference between revisions of "Tomcat Systemd"

From Dogtag
Jump to: navigation, search
m (Unit File)
m (Unit File)
Line 1: Line 1:
= Unit File =
+
= Systemd Unit File =
  
The Unit File tempmlate for Tomcat services is located at /lib/systemd/system/tomcat@.service:
+
The Systemd unit file for Tomcat is located at /lib/systemd/system/tomcat@.service:
  
 
<pre>
 
<pre>

Revision as of 01:01, 16 August 2019

Systemd Unit File

The Systemd unit file for Tomcat is located at /lib/systemd/system/tomcat@.service:

[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target

[Service]
Type=simple
EnvironmentFile=/etc/tomcat/tomcat.conf
Environment="NAME=%I"
EnvironmentFile=-/etc/sysconfig/tomcat@%I
ExecStart=/usr/libexec/tomcat/server start
ExecStop=/usr/libexec/tomcat/server stop
SuccessExitStatus=143
User=tomcat
Group=tomcat

[Install]
WantedBy=multi-user.target

See also:

Configuration

  • /etc/sysconfig/tomcat
  • /etc/tomcat/tomcat.conf
  • /etc/tomcat/conf.d

Starting Service

To start Tomcat service:

$ systemctl start tomcat

Stopping Service

To stop Tomcat service:

$ systemctl stop tomcat

Checking Status

To check Tomcat status:

$ systemctl status tomcat

To list ports used by Tomcat:

$ lsof -Pan -p <Tomcat PID> -i
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/13079/gvfs
      Output information may be incomplete.
COMMAND   PID   USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
java    24364 tomcat   51u  IPv6 377096101      0t0  TCP *:8080 (LISTEN)
java    24364 tomcat   56u  IPv6 377096105      0t0  TCP *:8009 (LISTEN)
java    24364 tomcat   75u  IPv6 377096117      0t0  TCP 127.0.0.1:8005 (LISTEN)

To list ports used by all processes:

$ netstat -tulpn

To run Tomcat in foreground:

$ /usr/libexec/tomcat/server start

See Also