This is an automated email from the ASF dual-hosted git repository.

rzo1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomee.git


The following commit(s) were added to refs/heads/main by this push:
     new c83d537967 Update the systemd service example (#3085)
c83d537967 is described below

commit c83d5379679d4df163810c89778638163d7593f1
Author: Richard Zowalla <[email protected]>
AuthorDate: Tue Oct 13 08:46:43 2026 +0200

    Update the systemd service example (#3085)
    
    Run as a dedicated user and group and show how to quote JAVA_OPTS.
---
 docs/deamon/lin-service.adoc | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/docs/deamon/lin-service.adoc b/docs/deamon/lin-service.adoc
index 1876fbf139..b195a96f70 100644
--- a/docs/deamon/lin-service.adoc
+++ b/docs/deamon/lin-service.adoc
@@ -7,9 +7,9 @@
 = Linux Service
 
 Depending on your flavor of Linux, there are likely a few different ways you 
can run TomEE as a service.
-This page demonstrates running as a service with systemd, and has been tested 
with RedHat Enterprise Linux.
+This page demonstrates running as a service with systemd, and has been tested 
with RedHat Enterprise Linux and Ubuntu.
 
-Create a file `/etc/systemd/system/tomee.service` with the following content:
+Create a dedicated user and group (here `tomee`) that owns the TomEE 
installation, then create a file `/etc/systemd/system/tomee.service` with the 
following content:
 
 [source]
 ----
@@ -18,25 +18,28 @@ Description=Apache TomEE
 After=network.target
 
 [Service]
-User=<user to run as>
+User=tomee
+Group=tomee
+WorkingDirectory=/opt/tomee
 Type=forking
-Environment=JAVA_HOME=/usr/lib/jvm/jre
+Environment=JAVA_HOME=/usr/lib/jvm/java-25-openjdk-amd64
 Environment=CATALINA_PID=/opt/tomee/temp/tomee.pid
 Environment=CATALINA_HOME=/opt/tomee
 Environment=CATALINA_BASE=/opt/tomee
-Environment=CATALINA_OPTS='-server'
-Environment=JAVA_OPTS='-Djava.awt.headless=true'
+Environment=CATALINA_OPTS=-server
+Environment="JAVA_OPTS=-Dfile.encoding=UTF-8 -Djava.awt.headless=true -Xms2g 
-Xmx3g"
 ExecStart=/opt/tomee/bin/startup.sh
 ExecStop=/opt/tomee/bin/shutdown.sh
-KillSignal=SIGCONT
 
 [Install]
 WantedBy=multi-user.target
 ----
 
-The file above assumes TomEE is extracted to `/opt/tomee`, and that 
`JAVA_HOME` is at `/usr/lib/jvm/jre` - adjust these to match your installation.
+The file above assumes TomEE is extracted to `/opt/tomee` and that `JAVA_HOME` 
is at `/usr/lib/jvm/java-25-openjdk-amd64` - adjust these, and the heap 
settings in `JAVA_OPTS`, to match your installation.
 
-Once done, run `sudo systemctl daemon-reload` so systemd is aware of the new 
service.
+A value containing spaces has to be quoted as a whole (`"JAVA_OPTS=..."`), and 
comments are not allowed inside a value.
+
+Once done, run `sudo systemctl daemon-reload` so systemd is aware of the new 
service, and `sudo systemctl enable tomee` to start it at boot.
 
 You should now be able to use the following commands to control the TomEE 
service:
 

Reply via email to