]> SALOME platform Git repositories - modules/kernel.git/blob - bin/appliskel/runAppli
Salome HOME
PAL6948 (Persistence in MED). Add "typedef H5T_order_t hdf_byte_order;"
[modules/kernel.git] / bin / appliskel / runAppli
1 #!/bin/bash
2
3 # --- retrieve APPLI path, relative to $HOME
4 #     on sarge, "which" gives not allways the absolute path...
5      
6 comName=`which $0`
7 aa=${comName:0:1}
8 if test x$aa == x\/; then
9   mycom=${comName}
10 elif test x$aa == x\.; then
11   mycom=${PWD}/${comName:2}
12 else
13   mycom=${PWD}/${comName}
14 fi
15 APPLI=`echo ${HOME} \`dirname $mycom\` | awk ' { print substr($2,length($1)+2) } '`
16 #echo $APPLI
17 export APPLI
18
19 # --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
20
21 . ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
22
23 # --- define port for CORBA naming service
24
25 searchFreePort() {
26     echo -n "Searching for a free port for naming service: "
27     export NSPORT=2810
28     local limit=$NSPORT
29     let limit=limit+100
30     while [ 1 ]
31     do
32         aRes=`netstat -ltn | grep -E :${NSPORT}`
33         if [ -z "$aRes" ]; then
34             echo ${NSPORT} - Ok
35             local myhost=`hostname`
36             export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_${NSPORT}.cfg
37             export NSPORT
38             export NSHOST=${myhost}
39             local initref="NameService=corbaname::"`hostname`":$NSPORT"
40             #echo "ORBInitRef $initref" > $OMNIORB_CONFIG
41             echo "InitRef = $initref" > $OMNIORB_CONFIG
42             export LAST_RUNNING_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg
43             rm ${LAST_RUNNING_CONFIG}
44             ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG}
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 # --- run SALOME
59 #    (default arguments defined in local salome.launch could be completed
60 #     by arguments to this command)
61
62 searchFreePort
63
64 if [ $# -ne 0 ] ; then
65     ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $*
66 else
67     ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py 
68 fi
69
70 rm ${OMNIORB_CONFIG}
71 rm ${LAST_RUNNING_CONFIG}