cancel
Showing results for 
Search instead for 
Did you mean: 

How to create service unit for SAP RedHat 7.x

Former Member
0 Kudos

Hello,

I'm trying to create service unit for SAP on RedHat 7. Start SAP is ok, but shutdown does not work. It not shutdown database correctly.

Here is my service unit:

[Unit]

Description=SAP sluzba

After=network.target sshd.target

Wants=network.target sshd.service

[Service]

Type=simple

RemainAfterExit=true

Environment="SAPSYSTEMNAME=RH7" "HOST=cz-brn1-rh7" "HOME=/home/rh7adm" "PATH=/sapdb/clients/RH7/bin:/sapdb/programs/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/sap/RH7/SYS/exe/uc/linuxx86_64:/usr/sap/RH7/SYS/exe/run:/home/rh7adm:." "DIR_LIBRARY=/usr/sap/RH7/SYS/exe/run" "LD_LIBRARY_PATH=/usr/sap/RH7/SYS/exe/run:/usr/sap/RH7/SYS/exe/uc/linuxx86_64:/sapdb/clients/RH7/lib" "RSEC_SSFS_DATAPATH=/usr/sap/RH7/SYS/global/security/rsecssfs/data" "RSEC_SSFS_KEYPATH=/usr/sap/RH7/SYS/global/security/rsecssfs/key"

KillMode=none

SendSIGKILL=no

TimeoutSec=5min

TimeoutStopSec=5min

User=rh7adm

Group=sapsys

ExecStart=/usr/sap/startsap

ExecStop=/usr/sap/stopsap

[Install]

WantedBy=graphical.target

Here is stopsap script:

#!/bin/bash

date >> /usr/sap/stopsap.log; /usr/sap/RH7/SYS/exe/uc/linuxx86_64/stopsap >> /usr/sap/stopsap.log 2>&1; whoami >> /usr/sap/stopsap.log;

It stuck in stopping SAP: I don't know where shoud be problem.

Mon Oct 19 12:37:26 CEST 2015

Checking  Database

-------------------------------------------

setTrace: false

WARNING: Cannot write class prefetch list; classload performance may be affected

WARNING: java.io.FileNotFoundException: class_prefetch.lst (Permission denied)

WARNING: To fix the problem, remove the inaccessible file /class_prefetch.lst

J2EE Database is running

See logfile /home/rh7adm/JdbcCon.log

stopping the SAP instance J28

Shutdown-Log is written to /home/rh7adm/stopsap_J28.log

-------------------------------------------

/usr/sap/RH7/J28/exe/sapcontrol -prot NI_HTTP -nr 28 -function Stop

Instance on host cz-brn1-rh7 stopped

Waiting for cleanup of resources

..................................................................................................................................................


[root@cz-brn1-rh7 ~]# chmod ls -ltr /usr/sap/RH7/J28/j2ee/cluster/class_prefetch.lst

-rwxrwxrwx. 1 rh7adm sapsys 89217 Oct 19 12:44 /usr/sap/RH7/J28/j2ee/cluster/class_prefetch.lst

Thank you for your help.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

Ok problem was in environment:

correct definition of sap.service is:

[Unit]

Description=SAP sluzba

After=network.target sshd.target

Wants=network.target sshd.service


[Service]

Type=simple

RemainAfterExit=true

#EnvironmentFile=/home/rh7adm/.cshrc

Environment="HOSTNAME=cz-brn1-rh7" "SAPSYSTEMNAME=RH7" "HOST=cz-brn1-rh7" "HOME=/home/rh7adm" "PATH=/sapdb/clients/RH7/bin:/sapdb/programs/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/sap/RH7/SYS/exe/uc/linuxx86_64:/usr/sap/RH7/SYS/exe/run:/home/rh7adm:." "DIR_LIBRARY=/usr/sap/RH7/SYS/exe/run" "LD_LIBRARY_PATH=/usr/sap/RH7/SYS/exe/run:/usr/sap/RH7/SYS/exe/uc/linuxx86_64:/sapdb/clients/RH7/lib" "RSEC_SSFS_DATAPATH=/usr/sap/RH7/SYS/global/security/rsecssfs/data" "RSEC_SSFS_KEYPATH=/usr/sap/RH7/SYS/global/security/rsecssfs/key"

KillMode=none

SendSIGKILL=no

TimeoutSec=5min

TimeoutStopSec=5min

User=rh7adm

Group=sapsys

ExecStart=/usr/sap/startsap

ExecStop=/usr/sap/stopsap

[Install]

WantedBy=graphical.target

Hope it help