Quote Originally Posted by btcbtc View Post
Hi Community,

i want to stop HANA DB automatically at reboot or shutdown on SLES12 SP5.

I created a systemd Service for stopping Hana DB but nothing happend.

Systemd Service:
[Unit]
Description=saphana
After=remote-fs.target user.slice sapinit.service multi-user.target
Requires=user.slice

[Service]
KillMode=none
Type=oneshot
ExecStart=/bin/true
ExecStop=/hana/source/scripts/stophanadb
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Script for stophanadb:
#!/bin/bash

su - SIDadm /usr/sap/SID/HDB00/HDB stop


Have anyone the same problem.

Best Regards
Gunnar
Hi and welcome to the Forum
You want to ExecStart the script, but you can define the user as well so no need to execute a script, use direct....

Code:
#
# /etc/systemd/system/saphana.service
#
[Unit]
Description=Shutdown SAP HANA
After=remote-fs.target user.slice sapinit.service multi-user.target
Requires=user.slice

[Service]
KillMode=none
Type=oneshot
User=SIDadm
ExecStart=/usr/sap/SID/HDB00/HDB stop
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target