cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Router configuration on Linux platform (error in start script)

joo_migueldimas
Active Participant
0 Kudos

Hello gurus,

I´m trying to setup the saprouter on Fedora v14 (32 bits).

I did all the configure with root user. The problem is when I run the script that starts the saprouter service, it show me the following error:

[root@saprouter sap]# pwd
/usr/sap/saprouter
[root@saprouter saprouter]# saprouter_start 
/usr/sap/saprouter/saprouter_start: line 12: syntax error near unexpected token `|'
'usr/sap/saprouter/saprouter_start: line 12: `        | tee -a $LOGFILE &

The content of this script, has the following sintaxes:

#
# Start saprouter
# You can automatically start SAProuter when you start the system. In UNIX for example, you would change file /etc/rc.
# saprouter CN=saprouter, OU=0001214237, OU=SAProuter, O=SAP, C=DE sapserv2
#
#
SRDIR=/usr/sap/saprouter
LOGFILE="usr/sap/saprouter/saprouter_log"
if [ -f $SRDIR/saprouter ] ; then
        echo "Starting SAP Router" | tee -a $LOGFILE
$SRDIR/saprouter -r -R $SRDIR/saprouttab -G $LOGFILE -W 60000 -K "p:CN=saprouter, OU=0001214237, OU=SAProuter, O=SAP, C=DE" 
        | tee -a $LOGFILE &
fi

The strange of this is I already did this type of configuration on Linux with the same scripts... but in red hat enterprise linux x86_64 and in there it works perfectly!

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/4f/992ce8446d11d189700000e8322d00/frameset.htm

Can you help me please in way to solve this problem...?!

Best regards,

João Dimas - Portugal

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

HI...

I just copy and past you script code and start the saprouter in my machine withtout issue.

Try to put the last "| tee -a $LOGFILE &" in teh same line of the command

cahnge from:

$SRDIR/saprouter -r -R $SRDIR/saprouttab -G $LOGFILE -W 60000 -K "p:CN=saprouter, OU=0001214237, OU=SAProuter, O=SAP, C=DE"

| tee -a $LOGFILE &

to

$SRDIR/saprouter -r -R $SRDIR/saprouttab -G $LOGFILE -W 60000 -K "p:CN=saprouter, OU=0001214237, OU=SAProuter, O=SAP, C=DE" | tee -a $LOGFILE &

at the same line!

Cheers,

Clébio

joo_migueldimas
Active Participant
0 Kudos

Hello Clebio,

Thank you for your answer...

So... I tried that but without success What I did was, I tested with two ways, but unfortunatelly both without success :

#
# Start saprouter
# You can automatically start SAProuter when you start the system. In UNIX for example, you would change file /etc/rc.
# saprouter CN=saprouter, OU=0001214237, OU=SAProuter, O=SAP, C=DE sapserv2
#
SRDIR=/usr/sap/saprouter
LOGFILE="usr/sap/saprouter/saprouter_log"
if [ -f $SRDIR/saprouter ] ; then
        echo "Starting SAP Router" | tee -a $LOGFILE
$SRDIR/saprouter -r -R $SRDIR/saprouttab -G $LOGFILE -W 60000 -K "p:CN=saprouter, OU=0001214237, OU=SAProuter, O=SAP, C=DE"  | tee -a $LOGFILE & fi

... and I tried to without "fi" in the end of this script:

#
# Start saprouter
# You can automatically start SAProuter when you start the system. In UNIX for example, you would change file /etc/rc.
# saprouter CN=saprouter, OU=0001214237, OU=SAProuter, O=SAP, C=DE sapserv2
#
SRDIR=/usr/sap/saprouter
LOGFILE="usr/sap/saprouter/saprouter_log"
if [ -f $SRDIR/saprouter ] ; then
        echo "Starting SAP Router" | tee -a $LOGFILE
$SRDIR/saprouter -r -R $SRDIR/saprouttab -G $LOGFILE -W 60000 -K "p:CN=saprouter, OU=0001214237, OU=SAProuter, O=SAP, C=DE"  | tee -a $LOGFILE &

... both tests result with the same erro:

[root@saprouter saprouter]# ./saprouter_start
./saprouter_start: line 11: syntax error: unexpected end of file

I have some questions for you Clebio:

Tell me one thing Clebio... your operation system is an Red Hat or a Fedora? ... and other thing, can you please put here the all content of your script file?

Other question... you put some variable systems in some files of your user profile, in which ones?

Other thing that is very strange, is when I run the command to start the saprouter directly (saprouter -r):

[root@saprouter saprouter]# saprouter -r
saprouter: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory

If you don´t mind, can you do that in your saprouter to test which is the behavior of system sap router...?!

Thank you

João Dimas - Portugal

0 Kudos

HI,

I test in Red Hat.

remove the "" of this command:

from:

$SRDIR/saprouter -r -R $SRDIR/saprouttab -G $LOGFILE -W 60000 -K "p:CN=saprouter, OU=0001214237, OU=SAProuter, O=SAP, C=DE" | tee -a $LOGFILE

to:

$SRDIR/saprouter -r -R $SRDIR/saprouttab -G $LOGFILE -W 60000 -K "p:CN=saprouter, OU=0001214237, OU=SAProuter, O=SAP, C=DE" | tee -a $LOGFILE

however seems that there are some dependency that could not be solved as per this output:

# saprouter -r

saprouter: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory

check with "ldd saprouter"

Clébio

joo_migueldimas
Active Participant
0 Kudos

Hello Clebio,

Thank you for your help...

Well... I already tried without "**" but again without success!

Tell me, because I have some doubts if I decided well some things during this saprouter installation...

First, on the first phase, when I did the download of saprouter and sap cryptographic, this Fedora (v.14) is a x32bits and because of this for saprouter I downloaded the version for Windows Server on IA32 32bit (file name: saprouter_15-20001568.sar) and for Criptographic software I downloaded the SAP Cryptographic Library Linux Intel x86! It is correct, isn´t it? I choosed well??!

Second... tell me another thing that I asked you in my previous message... you set the environment variables SNC_LIB and SECUDIR, in which file? Because I set this environment variables in .bash_profile file. This is right, isn´t it?

Next I show you the content of .bash_profile (for root user):

# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/usr/sap/saprouter
export PATH

SECUDIR=/usr/sap/saprouter
export SECUDIR

SNC_LIB=$SECUDIR/libsapcrypto.so
export SNC_LIB

... and third, I checked with "ldd saprouter" and the output is the following:

[root@saprouter saprouter]# ldd saprouter
	linux-gate.so.1 =>  (0x00110000)
	libdl.so.2 => /lib/libdl.so.2 (0x00911000)
	librt.so.1 => /lib/librt.so.1 (0x00918000)
	libstdc++.so.5 => not found
	libm.so.6 => /lib/libm.so.6 (0x00923000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00966000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x008f4000)
	libc.so.6 => /lib/libc.so.6 (0x00768000)
	/lib/ld-linux.so.2 (0x00747000)

Best regards,

João Dimas - Portugal

joo_migueldimas
Active Participant
0 Kudos

Hello Clebio,

First al all, please don´t forget to read my previous message.

I´m writing again because I made other tests that I would like to show you...!

1- In my previous message I mentioned an error when I ran directly the command # saprouter -r... and as you recomend, I typed the "ldd saprouter", the output of this show that libstdc+.so.5: was not found! I already solve this issue, I installed the compat-libstdc+ with # yum install compat-libstdc++. So... now when I run that "ldd saprouter" the result is:

[root@saprouter saprouter]# ldd saprouter
	linux-gate.so.1 =>  (0x003a9000)
	libdl.so.2 => /lib/libdl.so.2 (0x00911000)
	librt.so.1 => /lib/librt.so.1 (0x00918000)
	libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x00110000)
	libm.so.6 => /lib/libm.so.6 (0x00923000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00966000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x008f4000)
	libc.so.6 => /lib/libc.so.6 (0x00768000)
	/lib/ld-linux.so.2 (0x00747000)

It seems that is solved! Is not it?

2- After that correction, I ran again the # saprouter -r but now it show me the following error:

[root@saprouter saprouter]# saprouter -r

trcfile  dev_rout
no logging active

*** ERROR => invalid lines in './saprouttab', see 'dev_rout' [nirout.cpp   8006]

... next, what I did was, I opened the dev_rout:

---------------------------------------------------
trc file: "dev_rout", trc level: 1, release: "700"
---------------------------------------------------

Thu Aug 11 13:10:49 2011
SAP Network Interface Router, Version 38.10

command line arg 0:     saprouter
command line arg 1:     -r
main: pid = 9808, ppid = 2038, port = 3299, parent port = 0 (0 = parent is not a saprouter)
reading routtab: './saprouttab'
*** ERROR => SNC field without SNC active, skip line 2 [nirout.cpp   7775]
*** ERROR => SNC field without SNC active, skip line 3 [nirout.cpp   7775]
*** ERROR => SNC field without SNC active, skip line 8 [nirout.cpp   7775]

... and I also checked my saprouttab in there I see...:

1. vim saprouttab

# SNC connection to and from SAP
KT "p:CN=sapserv2, OU=SAProuter, O=SAP, C=DE" 194.39.131.34 *
KT "p:CN=saprouter, OU=000121987, OU=SAProuter, O=SAP, C=DE" 81.193.132.663 3299
#
# SNC connection to local system for R/3-Support
# R/3 Server: 192.168.34.178
# R/3 Instance: 00
KP "p:CN=sapserv2, OU=SAProuter, O=SAP, C=DE" 192.168.34.178 3200
#
# Access from the local Network to SAP
P * 194.39.131.34 3299
#
# Deny all other connections
#D * * *

What´s the problem!??! I don´t get it!! My God... I don´t understand, all the entries in saprouttab seems well to me! Can you verify this please?! It´s correct, isn´t it?

Can you help me!?

Thank you

João Dimas - Portugal

joo_migueldimas
Active Participant
0 Kudos

Hello Clebio... again...

Finally I start the saprouter... but directly from the terminal... (in the way that I did not want!)

[root@saprouter saprouter]# vim saprouter_start
[root@saprouter saprouter]# saprouter -r -W 60000 -K "p:CN=saprouter, OU=000121987, OU=SAProuter, O=SAP, C=DE"

trcfile  dev_rout
no logging active

But I still not understand why I don´t get to start the saprouter through this script! Surely this is because the operating system is Fedora and doesn´t the Red Hat... because in Red Hat with this script I can start the saprouter service and here in Fedora I don´t!

This have to do, or is related to some incompatibility with Fedora commands... syntax...! and that incompatibility is on that line:

$SRDIR/saprouter -r -R $SRDIR/saprouttab -G $LOGFILE -W 60000 -K "p:CN=saprouter, OU=0001214237, OU=SAProuter, O=SAP, C=DE" | tee -a $LOGFILE &

Something here, in this line, doesn´t match with Fedora syntax scripts...!!

What you think Clebio?!... Because I have to start this service through the script and not directly like I did!

Kind regards,

João Dimas - Portugal

0 Kudos

HI

What is the error right now that are you getting to start it from the script?

Are you still getting the same error?

/usr/sap/saprouter/saprouter_start: line 12: syntax error near unexpected token `|'

'usr/sap/saprouter/saprouter_start: line 12: ` | tee -a $LOGFILE &

Or is it another one?

What is the shell on the script? ksh?? bash?? tsh?

Clébio

joo_migueldimas
Active Participant
0 Kudos

Hello Clebio,

The error is exactly the same:

[root@saprouter saprouter]# ./saprouter_start
./saprouter_start: line 11: syntax error: unexpected end of file

> What is the shell on the script? ksh?? bash?? tsh?

Good question... the shell that I´m use is bash, I run the following command and this was the result:

[root@saprouter saprouter]# echo $SHELL
/bin/bash

[root@saprouter saprouter]# /bin/bash --version
GNU bash, version 4.1.7(1)-release (i386-redhat-linux-gnu)

Any tips?

Kind regards,

João Dimas - Portugal

0 Kudos

the error is not the same.

"syntax error: unexpected end of file"

is completely different error of:

"syntax error near unexpected token `|'"

Don't you think?????

Let me know the full script code.

joo_migueldimas
Active Participant
0 Kudos

Hi Clebio,

Of course not!

I answered that on the day Aug 13, 2011 8:18 PM.

The script is:

#
# Start saprouter
# You can automatically start SAProuter when you start the system. In UNIX for example, you would change file /etc/rc.
# saprouter CN=saprouter, OU=0001214237, OU=SAProuter, O=SAP, C=DE sapserv2
#
SRDIR=/usr/sap/saprouter
LOGFILE="/usr/sap/saprouter/saprouter_log"
if [ -f $SRDIR/saprouter ] ; then
        echo "Starting SAP Router" | tee -a $LOGFILE
$SRDIR/saprouter -r -R $SRDIR/saprouttab -G $LOGFILE -W 60000 -K "p:CN=saprouter, OU=0001214237, OU=SAProuter, O=SAP, C=DE" | tee -a $LOGFILE & fi

When I run the script it show an error:

[root@saprouter saprouter]# ./saprouter_start
./saprouter_start: line 11: syntax error: unexpected end of file

The shell, as I said in my previous message, is the bash shell.

Kind regards,

João Dimas - Portugal

0 Kudos

break line after the "&"

from:

$SRDIR/saprouter -r -R $SRDIR/saprouttab -G $LOGFILE -W 60000 -K "p:CN=saprouter, OU=0001214237, OU=SAProuter, O=SAP, C=DE" | tee -a $LOGFILE & fi

to

$SRDIR/saprouter -r -R $SRDIR/saprouttab -G $LOGFILE -W 60000 -K "p:CN=saprouter, OU=0001214237, OU=SAProuter, O=SAP, C=DE" | tee -a $LOGFILE &

fi

joo_migueldimas
Active Participant
0 Kudos

Hello Clebio,

Oh my God... lol finally I understood what´s happened and you know what... you will not believe what happened and why this was happening!... First at all, I do not have much experience in linux and because of that I made a crucial error... I wrote this script file for start and stop saprouter on a Windows machine and then transfer them to Fedora machine! So... in this weekend I tried to delete that files on Linux and create them directly in Linux... and after that, I ran the script without any error!... my God!

Certainly, this problem was related to some sintaxe/expressions on Windows platform... I found a command that works perfectly for this type of situation which converts the DOS files to Unix files...which can be very useful:

# dos2unix saprouter_start

Well, thank you very much Clebio... and sorry for this stupid thing...!

I will give you maximum points due to the effort that you demonstrated in this situation, you was very kind!

Best regards,

João Dimas - Portugal

Answers (0)