Skip to content

Administration Documentation

anja edited this page Apr 28, 2017 · 4 revisions

Install Instructions

See Setup

Service Configuration Scripts

Example for init.d

Adapt the following service configuration to your system and save it under /etc/init.d/liferay.

The example configuration assums that liferay is started by a user named liferay.

/etc/init.d/liferay

#!/bin/bash

# Startup script for the Tomcat server
#
# description: Starts and stops the Tomcat daemon.
# processname: liferay (java)
# pidfile: /var/run/liferay.pid


# See how we were called.
JAVA_7_HOME="/usr/lib/jvm/jdk1.7.0_60/"

case $1
in
start)

export JAVA_HOME=$JAVA_7_HOME
su - liferay -c 'sh /opt/liferay-portal-6.2-ce-ga2/tomcat-7.0.42/bin/startup.sh'
;;
stop)
export JAVA_HOME=$JAVA_7_HOME
su - liferay -c 'sh /opt/liferay-portal-6.2-ce-ga2/tomcat-7.0.42/bin/shutdown.sh'
;;
restart)
export JAVA_HOME=$JAVA_7_HOME
su - liferay -c 'sh /opt/liferay-portal-6.2-ce-ga2/tomcat-7.0.42/bin/shutdown.sh'
su - liferay -c 'sh /opt/liferay-portal-6.2-ce-ga2/tomcat-7.0.42/bin/startup.sh'
;;
*)
echo "Usage: /etc/init.d/liferay start|stop|restart"
;;
esac
exit 0

Example for systemd

Adapt the following service configuration to your system and save it under /etc/systemd/system/liferay.service.

You can activate the script with

systemctl enable liferay.service

and after that start, stop etc it with

systemctl status | start | stop liferay.service

systemd service file

[Unit]
Description=Liferay Portal 7GA3
After=network.target

[Service]
Type=forking
ExecStart=/opt/liferay-ce-portal-7.0-ga3/tomcat-8.0.32/bin/startup.sh
ExecStop=/opt/liferay-ce-portal-7.0-ga3/tomcat-8.0.32/bin/shutdown.sh
Environment="JAVA_HOME=/usr/lib/jvm/java-8-oracle"
User=tomcat
Group=tomcat

[Install]
WantedBy=multi-user.target
Alias=liferay.service
---