Salome HOME
PAL13183: correct environment variables in custom SALOME launching script (runAppli)
[samples/pyhello.git] / bin / runAppli.in
1 #!/bin/sh
2
3 if [ -z "${KERNEL_ROOT_DIR}" ] ; then 
4 export KERNEL_ROOT_DIR=@KERNEL_ROOT_DIR@
5 fi
6 if [ -z "${PYHELLO_ROOT_DIR}" ] ; then 
7 export PYHELLO_ROOT_DIR=@prefix@
8 fi
9
10 searchFreePort() {
11     echo -n "Searching for a free port for naming service: "
12     export NSPORT=2810
13     local limit=$NSPORT
14     let limit=limit+100
15     while [ 1 ]
16     do
17         aRes=`netstat -ltn | grep -E :${NSPORT}`
18         if [ -z "$aRes" ]; then
19             echo ${NSPORT} - Ok
20             local myhost=`hostname`
21             export OMNIORB_CONFIG=${HOME}/.omniORB_${myhost}_${NSPORT}.cfg
22             local initref="NameService=corbaname::"`hostname`":$NSPORT"
23             if [[ `python -c "import CORBA; print CORBA.ORB_ID"` = "omniORB4" ]]; then
24                 echo "InitRef = $initref" > $OMNIORB_CONFIG
25             else
26                 echo "ORBInitRef $initref" > $OMNIORB_CONFIG
27             fi
28             break
29         fi
30         echo -n "${NSPORT} "
31         if [[ $NSPORT -eq $limit ]] ; then
32             echo
33             echo "Can't find a free port to launch omniNames"
34             echo "Try to kill the running servers and then launch SALOME again."
35             exit
36         fi
37         let NSPORT=NSPORT+1
38     done
39 }
40
41 searchFreePort
42
43
44 ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python -i $PYHELLO_ROOT_DIR/bin/salome/myrunSalome.py --modules=PYHELLO --containers=cpp,python --killall
45
46