Salome HOME
PR: merge from branch BR_auto_V310 tag mergefrom_OCC_development_for_3_2_0a2_10mar06
[modules/kernel.git] / bin / runSalome.ksh
1 #!/bin/ksh
2
3 searchFreePort() {
4     echo -n "Searching for a free port for naming service: "
5     NSPORT=2810
6     export NSPORT
7     local limit=$NSPORT
8     let limit=limit+100
9     while [ 1 ]
10     do
11         aRes=`netstat -ltn | grep -E :${NSPORT}`
12         if [ -z "$aRes" ]; then
13             echo ${NSPORT} - Ok
14             local myhost=`hostname`
15             OMNIORB_CONFIG=${HOME}/.omniORB_${myhost}_${NSPORT}.cfg
16             export OMNIORB_CONFIG
17             local initref="NameService=corbaname::"`hostname`":$NSPORT"
18             export 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 if [[ "$*" = "-nothing" ]]; then
40     echo "port:$NSPORT"
41 elif [ $# -ne 0 ] ; then
42     python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $* 
43 else
44     python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py
45 fi
46
47 # -----------------------------------------------------------------------------
48 # examples:
49 # ---------
50 #  $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome
51 #
52 #     - parameters for launching are taken from $HOME/.salome/salome.launch;
53 #     - if the config file does not exist, it is created with default values.
54 #
55 #  
56 #  $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,SUPERV,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer,supervContainer --xterm --killall
57 #
58 #     parameters from command line supersede those from $HOME/.salome/salome.launch
59 #
60 # Some CORBA servers can be launched in the SALOME_Session_Server's process
61 # (embedded = same process) or in a separate process (standalone):
62 # --> registry,study,moduleCatalog,cppContainer
63 # Other CORBA servers could only be launched in separate process (standalone):
64 # --> pyContainer,supervContainer
65 #
66 # $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome -h
67 #    help
68 # -----------------------------------------------------------------------------
69 #
70 # l'option -i permet de garder l'interpreteur python ouvert :
71 # par defaut, les differents serveurs ouvrent des fenĂȘtres xterm
72 # (cf. runSalome.py)
73 # le serveur Logger n'est pas obligatoire (commentĂ© dans runSalome.py)
74
75 # -----------------------------------------------------------------------------
76 # Example on CCRT (without ihm) :
77 # ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --terminal --modules=MED,CALCULATOR,COMPONENT --standalone=registry,study,moduleCatalog,cppContainer,pyContainer,supervContainer --killall