IBM Sterling Connect:Direct : Start/Stop Script with SystemD Support

From Wiki

Start Script

Create this start script on <CD_HOMEDIR>/cdunix/ndm/bin/startcd.sh, with this content:

#!/bin/bash

CD_HOMEDIR=/home/cdadmin02
CD_NODENAME=CDNODE02
cd $CD_HOMEDIR/cdunix/ndm/bin/ && ./cdpmgr -i $CD_HOMEDIR/cdunix/ndm/cfg/$CD_NODENAME/initparm.cfg

Stop Script

Create this stop script on <CD_HOMEDIR>/cdunix/ndm/bin/stopcd.sh, with this content:

#!/bin/bash

CD_HOMEDIR=/home/cdadmin02
NDMAPICFG=$CD_HOMEDIR/cdunix/ndm/cfg/cliapi/ndmapi.cfg
export NDMAPICFG

# Execute sel pro command
$CD_HOMEDIR/cdunix/ndm/bin/direct -s << EOJ
stop;
EOJ

Create SystemD file

Create this stop script on /etc/systemd/system/cd-CDNODE02.service, with this content:

[Unit]
Description=Connect:Direct
After=syslog.target network.target

[Service]
Restart=always
User=cdadmin02
ExecStart=/home/cdadmin02/cdunix/ndm/bin/startcd.sh
ExecStop=/home/cdadmin02/cdunix/ndm/bin/stopcd.sh

[Install]
WantedBy=multi-user.target

And run commands to enable and start Connect:Direct

systemctl enable cd-CDNODE02.service
systemctl start cd-CDNODE02.service

check status

 systemctl status cd-CDNODE02.service

To stop Connect:Direct

 systemctl stop cd-CDNODE02.service

Ver também