IBM Sterling Connect:Direct : Start/Stop Script with SystemD Support
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 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CD_HOMEDIR/ndm/lib export LD_LIBRARY_PATH count=$(ps -ef | grep cdpmgr | grep -v grep | grep -c "$CD_NODENAME") if [ $count -gt 0 ]; then exit 0 else cd $CD_HOMEDIR/cdunix/ndm/bin/ && ./cdpmgr -i $CD_HOMEDIR/cdunix/ndm/cfg/$CD_NODENAME/initparm.cfg fi
Stop Script
Create this stop script on <CD_HOMEDIR>/cdunix/ndm/bin/stopcd.sh, with this content:
#!/bin/bash CD_HOMEDIR=/home/cdadmin02 CD_NODENAME=CDNODE02 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CD_HOMEDIR/ndm/lib export LD_LIBRARY_PATH NDMAPICFG=$CD_HOMEDIR/cdunix/ndm/cfg/cliapi/ndmapi.cfg export NDMAPICFG count=$(ps -ef | grep cdpmgr | grep -v grep | grep -c "$CD_NODENAME") # check if cdpmgr is running if [ $count -eq 0 ]; then exit 0 fi # Execute direct command cd $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] Type=forking 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