Using Systemd to manage the PowerConnect for SAP HANA DB Agent
The PowerConnect for SAP HANA DB agent can be managed by Systemd.
Get the SAPSYSTEMNAME and SAP_RETRIEVAL_PATH environment variables from the HANA DB OS user (we need these because systemd does not get these for us)
env | grep SAP
Create the powerconnect systemd service file:
sudo vi /etc/systemd/system/powerconnect.service
Populate the contents as follows replacing the SAPSYSTEMNAME and SAP_RETRIEVAL_PATH with the values you collected above and the User and Group with the HANA DB os user and group:
[Unit]
Description=PowerConnect for SAP HANA DB agent
[Service]
Environment=SAPSYSTEMNAME=<insert SAPSYSTEM NAME here>
Environment=SAP_RETRIEVAL_PATH=<insert SAP_RETRIEVAL_PATH here>
SuccessExitStatus=143
User=<insert hana db os user here>
Group=<insert hana db os user group here>
Type=forking
Restart=on-failure
RestartSec=30
ExecStart=/bin/bash /opt/powerconnect/bin/powerconnect.sh start
ExecStop=/bin/bash /opt/powerconnect/bin/powerconnect.sh stop
[Install]
WantedBy=multi-user.target
Reload the Systemd service:
sudo systemctl daemon-reload
Start the PowerConnect for SAP HANA DB agent using Systemd:
sudo systemctl start powerconnect.service
Check the status:
systemctl status powerconnect
To have Systemd start the PowerConnect for SAP HANA DB agent when the host starts up:
sudo systemctl enable powerconnect