Salome HOME
PR: mergefrom_PAL_OCC_21Oct04
[modules/kernel.git] / bin / runSalome
1 #!/bin/bash
2
3 searchFreePort() {
4     echo -n "Searching for a free port for naming service: "
5     export NSPORT=2810
6     local limit=$NSPORT
7     let limit=limit+100
8     while [ 1 ]
9     do
10         aRes=`netstat -ltn | grep -E :${NSPORT}`
11         if [ -z "$aRes" ]; then
12             echo ${NSPORT} - Ok
13             local myhost=`hostname`
14             export OMNIORB_CONFIG=${HOME}/.omniORB_${myhost}_${NSPORT}.cfg
15             local initref="NameService=corbaname::"`hostname`":$NSPORT"
16             echo "ORBInitRef $initref" > $OMNIORB_CONFIG
17             break
18         fi
19         echo -n "${NSPORT} "
20         if [[ $NSPORT -eq $limit ]] ; then
21             echo
22             echo "Can't find a free port to launch omniNames"
23             echo "Try to kill the running servers and then launch SALOME again."
24             exit
25         fi
26         let NSPORT=NSPORT+1
27     done
28 }
29
30 searchFreePort
31
32 if [ $# -ne 0 ] ; then
33     python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $* 
34 else
35     python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py
36 fi
37
38 # -----------------------------------------------------------------------------
39 # examples:
40 # ---------
41 #  $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome
42 #
43 #     - parameters for launching are taken from $HOME/.salome/salome.launch;
44 #     - if the config file does not exist, it is created with default values.
45 #
46 #  
47 #  $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,SUPERV,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer,supervContainer --xterm --killall
48 #
49 #     parameters from command line supersede those from $HOME/.salome/salome.launch
50 #
51 # Some CORBA servers can be launched in the SALOME_Session_Server's process
52 # (embedded = same process) or in a separate process (standalone):
53 # --> registry,study,moduleCatalog,cppContainer
54 # Other CORBA servers could only be launched in separate process (standalone):
55 # --> pyContainer,supervContainer
56 #
57 # $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome -h
58 #    help
59 # -----------------------------------------------------------------------------
60 #
61 # l'option -i permet de garder l'interpreteur python ouvert :
62 # par defaut, les differents serveurs ouvrent des fenĂȘtres xterm
63 # (cf. runSalome.py)
64 # le serveur Logger n'est pas obligatoire (commentĂ© dans runSalome.py)
65
66 # -----------------------------------------------------------------------------