sudo nano /etc/systemd/system/liferay.service
Add the following contents (make sure to user your own paths)
[Unit]
Description=Liferay Apache Tomcat Web Application Container
After=network.target
[Service]
Type=forking
#Environment=JAVA_HOME=/usr/lib/jvm/java-8-oracle
#Environment=CATALINA_PID=/opt/liferay-dxp-7.2.10-ga1/tomcat-9.0.17/temp/tomcat.pid
#Environment=CATALINA_HOME=/opt/liferay-dxp-7.2.10-ga1/tomcat-9.0.17
#Environment=CATALINA_BASE=/opt/liferay-dxp-7.2.10-ga1/tomcat-9.0.17
#Environment='CATALINA_OPTS=-Xms1024M -Xmx2048M -server -XX:+UseParallelGC'
#Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'
ExecStart=/opt/liferay-dxp-7.2.10-ga1/tomcat-9.0.17/bin/startup.sh
ExecStop=/opt/liferay-dxp-7.2.10-ga1/tomcat-9.0.17/bin/shutdown.sh
User=ubuntu
Group=ubuntu
#UMask=0007
#RestartSec=10
#Restart=always
[Install]
WantedBy=multi-user.target
When you are finished, save and close the file.
Next, reload the systemd daemon so that it knows about our service file:
sudo systemctl daemon-reload
Now enable the service
sudo systemctl enable liferay
Start the Liferay service by typing:
sudo systemctl start liferay
Double check that it started without errors by typing:
sudo systemctl status liferay
Thank you very much! Helped me a lot!