Salome HOME
PR: merge from branch BR_UT_V310a3 tag mergeto_trunk_05dec05
[modules/kernel.git] / bin / appliskel / runRemote.sh
1 #!/bin/bash
2 #
3 # --- run command in SALOME environment from remote call, ssh or rsh
4 #     - SALOME configuration is defined by :
5 #        - list of MODULE_ROOT_DIR
6 #        - prerequisite environment
7 #        - specific configuration for a particular SALOME application
8 #     - These elements of configuration are defined locally on each computer
9 #       in the directory APPLI:
10 #     - A SALOME application distributed on several computers needs APPLI
11 #       directories on the same path ($APPLI) relative to $HOME directory
12 #       of the user, on each computer.
13 #
14 # --- call example (from cli76cd to cli76ce):
15 # ssh cli76ce ${APPLI}/runRemote.sh cli76cd 2810 SALOME_Container myContainerName
16 #
17 # --- local arguments
18 #     $0 : ${APPLI}/runRemote.sh: from arg name, rebuild and export $APPLI variable
19 #     $1 : computer name for CORBA name service (where SALOME was launched)
20 #     $2 : port for CORBA name service
21 #     $3 and following : local command to execute, with args
22 #
23
24 # --- retrieve APPLI path, relative to $HOME, set ${APPLI}
25
26 . `dirname $0`/setAppliPath.sh
27
28 # --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
29
30 . ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
31
32 # --- set the OMNIORB_CONFIG file and environment relative to this run of SALOME
33
34 export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_$1_$2.cfg
35 export NSHOST=$1
36 export NSPORT=$2
37 initref="NameService=corbaname::"$1":$2"
38 echo "ORBInitRef $initref" > $OMNIORB_CONFIG
39
40 # --- execute the command in the SALOME environment
41
42 shift 2
43
44 ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile $HOME/$APPLI/.bashrc -c "$*"