Salome HOME
Example of a c++ component with engine from Salome tutorial
[samples/atomsolv.git] / bin / runAppli.in
1 #!/bin/sh
2
3 #  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
4 #
5 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
6 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 #
8 #  This library is free software; you can redistribute it and/or
9 #  modify it under the terms of the GNU Lesser General Public
10 #  License as published by the Free Software Foundation; either
11 #  version 2.1 of the License.
12 #
13 #  This library is distributed in the hope that it will be useful,
14 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 #  Lesser General Public License for more details.
17 #
18 #  You should have received a copy of the GNU Lesser General Public
19 #  License along with this library; if not, write to the Free Software
20 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21 #
22 #  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
23
24 export KERNEL_ROOT_DIR=@KERNEL_ROOT_DIR@
25 export ATOMSOLV_ROOT_DIR=@prefix@
26
27 searchFreePort() {
28     echo -n "Searching for a free port for naming service: "
29     export NSPORT=2810
30     local limit=$NSPORT
31     let limit=limit+100
32     while [ 1 ]
33     do
34         aRes=`netstat -ltn | grep -E :${NSPORT}`
35         if [ -z "$aRes" ]; then
36             echo ${NSPORT} - Ok
37             local myhost=`hostname`
38             export OMNIORB_CONFIG=${HOME}/.omniORB_${myhost}_${NSPORT}.cfg
39             local initref="NameService=corbaname::"`hostname`":$NSPORT"
40             if [[ `python -c "import CORBA; print CORBA.ORB_ID"` = "omniORB4" ]]; then
41                 echo "InitRef = $initref" > $OMNIORB_CONFIG
42             else
43                 echo "ORBInitRef $initref" > $OMNIORB_CONFIG
44             fi
45             break
46         fi
47         echo -n "${NSPORT} "
48         if [[ $NSPORT -eq $limit ]] ; then
49             echo
50             echo "Can't find a free port to launch omniNames"
51             echo "Try to kill the running servers and then launch SALOME again."
52             exit
53         fi
54         let NSPORT=NSPORT+1
55     done
56 }
57
58 searchFreePort
59
60
61 ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python -i $ATOMSOLV_ROOT_DIR/bin/salome/myrunSalome.py --modules=ATOMSOLV --containers=cpp,python --killall