3 # Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG
4 # PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
10 # This library is distributed in the hope that it will be useful
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # --- run command in SALOME environment from remote call, ssh or rsh
23 # - SALOME configuration is defined by :
24 # - list of MODULE_ROOT_DIR
25 # - prerequisite environment
26 # - specific configuration for a particular SALOME application
27 # - These elements of configuration are defined locally on each computer
28 # in the directory APPLI:
29 # - A SALOME application distributed on several computers needs APPLI
30 # directories on the same path ($APPLI) relative to $HOME directory
31 # of the user, on each computer.
33 # --- call example (from cli76cd to cli76ce):
34 # ssh cli76ce ${APPLI}/runRemote.sh cli76cd 2810 SALOME_Container myContainerName
37 # $0 : ${APPLI}/runRemote.sh: from arg name, rebuild and export $APPLI variable
38 # $1 : computer name for CORBA name service (where SALOME was launched)
39 # $2 : port for CORBA name service
40 # $3 : working directory
41 # $4 and following : local command to execute, with args
44 # --- retrieve APPLI path, relative to $HOME, set ${APPLI}
46 APPLI_HOME=`dirname $0`
47 export APPLI=`${APPLI_HOME}/getAppliPath.py`
49 # --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
51 . ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
53 # --- set the OMNIORB_CONFIG file and environment relative to this run of SALOME
55 OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_$1_$2.cfg
61 initref="NameService=corbaname::"$1":$2"
62 echo "ORBInitRef $initref" > $OMNIORB_CONFIG
64 #go to the requested working directory if any
65 if test "x$3" != x; then
66 if test "x$3" = "x\$TEMPDIR"; then
67 #create a temp working dir and change to it
73 #the dir exists, go to it
77 # It's a file do nothing
78 echo $3 "is an existing file. Can't use it as a working directory"
80 #It does not exists, create it
89 # --- execute the command in the SALOME environment
93 # suppress --rcfile option because of problem on Mandriva2006 - B Secher mai 2007
94 #${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/sh --rcfile $HOME/$APPLI/.bashrc -c "$*"
95 ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/sh -c "$*"