Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Hello,

I just want to share a script to start the saprouter in a easy way on unix. Just put the content bellow in a sh file, and pay attentio on the variables.

Then, just execute "sh start_saprouter.sh" for example, or put some schedule on it.

I hope it is useful.

Regards,

Richard W. L. Brehmer
http://www.rbrehmer.com

start_saprouter.sh

### Variables ###

porta="3299";

SECUDIR="/usr/sap/saprouter";

SNC_LIB="/usr/sap/saprouter/libsapcrypto.so";

DNAME="p:CN=server, OU=0001000000, OU=SAProuter, O=SAP, C=DE";

### Variables end ###

### Check if saprouter is already running:

pid1="`netstat -nlp | grep '0.0.0.0:'"$porta"'.*saprouter' | sed -n 1p |awk '{print $7}' | cut -f1 -d "/" `";

if [ -f $pid1 ]

then # Not running.

  ### check if the port is free:

  echo -e "\nChecking port...";

  processo="`netstat -nlp | grep 0.0.0.0:"$porta" | sed -n 1p |awk '{print $7}' | cut -f1 -d "/"`";

  sleep 2;

  # If port free:

  if [ -f $processo ]

  then

  echo -e '\nStarting SAPRouter on port: ' $porta;

  sleep 2;

  export SECUDIR=$SECUDIR

  export SNC_LIB=$SNC_LIB

  /usr/sap/saprouter/./saprouter -r -R "$SECUDIR/saprouttab" -W 60000 -G "$SECUDIR/saprouterlog.txt" -S $porta -K "$DNAME" &

  pid="`netstat -nlp | grep '0.0.0.0:'"$porta"'.*saprouter' | sed -n 1p |awk '{print $7}' | cut -f1 -d "/" `";

  echo -e "\n\nSAPRouter is running on PID: "$pid;

  echo -e "\n";

  exit;

  # if the port isnot free.

  else

  echo -e '-------------------------------------------------------\n';

  echo -e ' It is not possible to start SAPRouter\n';

  echo -e ' The PID: '$processo' is already using the port: ' $porta;

  echo -e '-------------------------------------------------------\n';

  fi

  ###################

else # Its already running.

  echo -e "\nSAPRouter is already running";

  pid="`ps -ef |grep saprouter | sed -n 1p |awk '{print $2}' `";

  echo -e "\nPID: "$pid;

  echo -e "\n";

  sleep 2;

fi

1 Comment
Labels in this area