DUAS systemd script for RHEL9
search cancel

DUAS systemd script for RHEL9

book

Article ID: 370383

calendar_today

Updated On:

Products

CA Automic Dollar Universe

Issue/Introduction

How to create a systemd service for a DUAS node on RHEL9 and other Linux distributions that don't accept the sysv script delivered currently in the product (7.00.21 and inferior).

Environment

DUAS 6.x and 7.x

Resolution

This is the procedure to create a systemd service for starting a DUAS node. First, you need to login to the server as the root user and then follow these steps:

There are 2 ways of doing this, the first one has been tested more elaborately:

First method:

Create a start script called: <du_rootdir>/unistart_<du_company>_<du_node>.sh containing:

#!/bin/sh
rc_script=0
. <du_rootdir>/<du_company>_<du_node>/unienv.ksh
<du_rootdir>/<du_company>_<du_node>/bin/unistart
rc_script=$?
exit $rc_script

Create a stop script called <du_rootdir>/unistop_<du_company>_<du_node>.sh containing:

#!/bin/sh
rc_script=0
. <du_rootdir>/<du_company>_<du_node>/unienv.ksh
<du_rootdir>/<du_company>_<du_node>/bin/unistop
rc_script=$?
exit $rc_script

Create the systemd script called /etc/systemd/system/DUAS_<du_company>_<du_node>.service containing:

[Unit]
Description=DUAS Daemon (<du_company>_<du_node>)
After=syslog.target network.target

[Service]
Type=forking
WorkingDirectory=<du_rootdir>
ExecStart=<du_rootdir>/unistart_<du_company>_<du_node>.sh
ExecStop=<du_rootdir>/unistop_<du_company>_<du_node>.sh
User=univa

[Install]
WantedBy=multi-user.target

Now install the script with the commands:

systemctl  daemon-reload
systemctl enable DUAS_<du_company>_<du_node>.service

+++

Second method: 

Create the systemd script called /etc/systemd/system/DUAS_<du_company>_<du_node>.service containing:

[Unit]
Description=DUAS Daemon (<du_company>_<du_node>)
After=syslog.target network.target

[Service]
Type=forking
WorkingDirectory=<du_rootdir>
ExecStart=/bin/sh -c 'source <du_rootdir>/unienv.ksh && <du_rootdir>/bin/unistart'
ExecStop=/bin/sh -c 'source <du_rootdir>/unienv.ksh' && <du_rootdir>/bin/unistop'
User=univa

[Install]
WantedBy=multi-user.target

Now install the script with the commands:

systemctl  daemon-reload
systemctl enable DUAS_<du_company>_<du_node>.service

+++

Stopping and starting

After rebooting the server the DUAS node will now start automatically or you can stop/start the node with the command:

systemctl stop|start DUAS_<du_company>_<du_node>.service