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