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