search cancel

How to Automatically Start/Stop CABI Services in a non-root installation?

book

Article ID: 237599

calendar_today

Updated On:

Products

CA Spectrum DX NetOps

Issue/Introduction

How to Automatically Start/Stop CABI Services in a non-root installation?

Environment

Release : All Supported Releases

Component : SPCJSP - Jaspersoft for CA Spectrum

Resolution

The below steps are for a Jasper environment with the following details:

Install User - spectrum

<JASPERROOT> - /home/spectrum/CABI

 

- Create a /usr/lib/systemd/system/postgresql.service file with the below:

# Systemd unit file for postresql
[Unit]
Description=PostgreSQL database server
After=network.target

[Service]
Type=forking

User=spectrum
Group=spectrum

# Maximum number of seconds pg_ctl will wait for postgres to start.  Note that
# PGSTARTTIMEOUT should be less than TimeoutSec value.
Environment=PGSTARTTIMEOUT=270

Environment=PGDATA=/home/spectrum/CABI/postgresql/data

ExecStart=/home/spectrum/CABI/postgresql/bin/pg_ctl start -D ${PGDATA} -s -w -t ${PGSTARTTIMEOUT}
ExecStop=/home/spectrum/CABI/postgresql/bin/pg_ctl stop -D ${PGDATA} -s -m fast
ExecReload=/home/spectrum/CABI/postgresql/bin/pg_ctl reload -D ${PGDATA} -s

# Give a reasonable amount of time for the server to start up/shut down.
# Ideally, the timeout for starting PostgreSQL server should be handled more
# nicely by pg_ctl in ExecStart, so keep its timeout smaller than this value.
TimeoutSec=300

[Install]
WantedBy=multi-user.target

 

- Create a /usr/lib/systemd/system/tomcat.service file with the below:

# Systemd unit file for tomcat
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target

[Service]
Type=forking

Environment=JAVA_HOME=/home/spectrum/CABI/java
Environment=CATALINA_PID=/home/spectrum/CABI/apache-tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/home/spectrum/CABI/apache-tomcat
Environment=CATALINA_BASE=/home/spectrum/CABI/apache-tomcat
Environment='CATALINA_OPTS=-Xms4096m -Xmx6144m -server -Xss2m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/home/spectrum/CABI/apache-tomcat/bin/startup.sh
ExecStop=/home/spectrum/CABI/apache-tomcat/bin/shutdown.sh

User=spectrum
Group=spectrum
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

- Once the files are created, run the below commands:

 systemctl daemon-reload
 systemctl enable postgresql
 systemctl enable tomcat

 

Additional Information

This process needs to be configured/supported by the server administrator since this is an Operating System configuration.