Saturday 15 July 2023

Configuring SAProuter as a service on Linux

 


SAP Router installation on Linux: click here. once the SAP Router installation.
Follow the below Steps to configure SAP Router "as a service" in a Linux environment (SUSE,REDHAT,,,,etc).

First of all, create the below two service files at the mention location.

1. Execute the below command to Create ".service" and ".sh" files (on linux)

saprouter:/etc/systemd/system # touch saprouter.service
saprouter:/etc/init.d # touch startsaprouter.sh

2.  Add the below entries to the "saprouter.service" file based on your environment. 

saprouter:/etc/systemd/system # vim saprouter.service

[Unit]

Description = SAP Router start Service
After = network.target

[Service]
ExecStart = /etc/init.d/startsaprouter.sh

[Install]
WantedBy = default.target


3.   Add the below entries to the "startsaprouter.shfile based on your environment.

saprouter:/etc/init.d # cat startsaprouter.sh
#!/bin/sh
export SECUDIR="/usr/sap/saprouter"
export SNC_LIB="/usr/sap/saprouter/libsapcrypto.so"
export LD_LIBRARY_PATH="/usr/sap/saprouter"
export LIBPATH="/usr/sap/saprouter"
cd /usr/sap/saprouter
./saprouter -r -K "p:CN=saprouter,OU=0000123456,OU=SAProuter,O=SAP,C=DE"

4.    Save and execute the below command to provide permission for the .service and .sh files.

saprouter: chmod 775 /etc/init.d/startsaprouter.sh
saprouter: chmod 775 /etc/systemd/system/saprouter.service

5.  Execute the below command to Start the SAP Router as a Service.

saprouter:/etc/systemd/system # systemctl start saprouter.service

6.    Check the SAP Router status.

saprouter:/etc/systemd/system # systemctl status saprouter.service

Saprouter.service - Saprouter start
     
Loaded: loaded (/etc/systemd/system/saprouter.service; disabled; vendor preset: disabled)
     Active: active (running) since Sat 2023-07-15 10:58:06 IST; 5s ago
   Main PID: 7961 (startsaprouter.)
      Tasks: 2
     CGroup: /system.slice/saprouter.service
             ├─ 7961 /bin/sh /etc/init.d/startsaprouter.sh
             └─ 7962 ./saprouter -r -K p:CN=saprouter,OU=0000123456,OU=SAProuter,O=SAP,C=DE


7. Use the below command to enable the automatic startup of the SAP Router service.

saprouter:/etc/systemd/system # systemctl enable saprouter.service

Created symlink /etc/systemd/system/default.target.wants/saprouter.service → /etc/systemd/system/saprouter.service.


8.    Check the status of the SAP Router service with the Startup option.

saprouter:/etc/systemd/system # systemctl status saprouter.service
 
saprouter.service - Saprouter start
     Loaded: loaded (/etc/systemd/system/saprouter.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2023-07-15 10:58:06 IST; 41s ago
   Main PID: 7961 (startsaprouter.)
      Tasks: 2
     CGroup: /system.slice/saprouter.service
             ├─ 7961 /bin/sh /etc/init.d/startsaprouter.sh
             └─ 7962 ./saprouter -r -K p:CN=saprouter,OU=0000123456,OU=SAProuter,O=SAP,C=DE

Note: Kindly give the correct "Distinguished Name" for smooth execution.


Thanks.
Happy reading.