Salome HOME
Copyrights update 2015.
[tools/simanio.git] / scripts / run_salome_siman.sh
1 #!/bin/bash
2
3 # Copyright (C) 2013-2015  CEA/DEN, EDF R&D, OPEN CASCADE
4 #
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, or (at your option) any later version.
9 #
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.
14 #
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
18 #
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #
21
22 exec 3>&1 4>&2
23 trap 'exec 2>&4 1>&3' 0 1 2 3
24 exec 1>${HOME}/siman_salome_log.out 2>&1
25
26 echo "the script execution is logged to the log file ${HOME}/siman_salome_log.out" >&3
27
28 echo "parameters 1: $1  $2  $3"
29 echo "number of parameters = $#"
30
31 if [ "$#" -ne 3 ] ; then 
32 echo  "Usage :
33 `basename $0` --siman-study=<studyID> --siman-scenario=<scenarioID> --siman-user=<userID>" >&3
34 echo  "for example : 
35 `basename $0` --siman-study=1162 --siman-scenario=1163 --siman-user=1158" >&3
36 exit
37 fi
38
39 if [ -z "${SALOME_ROOT_DIR}" ]; then
40     echo "You need to set the environment variable SALOME_ROOT_DIR" >&3
41     exit 1
42 fi
43
44 echo
45 echo "SALOME_ROOT_DIR = " ${SALOME_ROOT_DIR}
46
47 env_script=${SALOME_ROOT_DIR}/env_products.sh
48 echo script = $env_script
49
50 if [ -e $env_script ] ; then
51     echo 
52     echo ">>> Setting SALOME environment" 
53     echo ">>> Environment script = " $env_script 
54     . $env_script 
55     else
56     echo 
57     echo '!!! Warning !!! SALOME Environment is not set.' 
58     echo 'No environment file (env_products.sh) is found.' 
59     echo 'Proceed with the current environment.' 
60 fi
61
62 castem_env_script=${SALOME_ROOT_DIR}/castem_env_products.sh
63
64 if [ -e $castem_env_script ] ; then
65     echo 
66     echo ">>> Setting CASTEM environment" 
67     echo ">>> Environment script = " $castem_env_script 
68     . $castem_env_script 
69     else
70     echo 
71     echo '!!! Warning !!! CASTEM Environment is not set.' 
72     echo 'No environment file (castem_env_products.sh) is found.' 
73     echo 'Proceed with the current environment.' 
74 fi
75
76 echo "CASTEM_ROOT_DIR = " $CASTEM_ROOT_DIR 
77 echo
78
79 eficas_aster_env_script=${SALOME_ROOT_DIR}/eficas_aster_env_products.sh
80
81 if [ -e $eficas_aster_env_script ] ; then
82     echo 
83     echo ">>> Setting EFICAS & ASTER environment" 
84     echo ">>> Environment script = " $eficas_aster_env_script
85     . $eficas_aster_env_script 
86     else
87     echo 
88     echo '!!! Warning !!! EFICAS & ASTER Environment is not set.' 
89     echo 'No environment file (eficas_aster_env_products.sh) is found.' 
90     echo 'Proceed with the current environment.' 
91 fi
92
93 echo "EFICAS_ROOT_DIR = " $EFICAS_ROOT_DIR
94 echo "ASTER_ROOT_DIR = " $ASTER_ROOT_DIR
95 echo
96
97
98 syrthes_env_script=${SALOME_ROOT_DIR}/syrthes_env_products.sh
99
100 if [ -e $syrthes_env_script ] ; then
101     echo 
102     echo ">>> Setting SYRTHES environment" 
103     echo ">>> Environment script = " $syrthes_env_script
104     . $syrthes_env_script
105     else
106     echo 
107     echo '!!! Warning !!! SYRTHES Environment is not set.' 
108     echo 'No environment file (syrthes_env_products.sh) is found.' 
109     echo 'Proceed with the current environment.' 
110 fi
111
112 echo "SYRTHES_ROOT_DIR = " $SYRTHES_ROOT_DIR
113 echo
114
115 echo ">>> Setting SALOME-SIMAN environment" 
116
117 export WSFCPP_HOME=${SALOME_ROOT_DIR}/wso2-wsf-cpp-2.1.0
118 export LD_LIBRARY_PATH=${WSFCPP_HOME}/lib:${LD_LIBRARY_PATH}
119 echo "WSFCPP_HOME = " ${WSFCPP_HOME} 
120 rm -f ${WSFCPP_HOME}/logs/SimanSalomeService.log
121
122 export SIMANIO_ROOT_DIR=${SALOME_ROOT_DIR}/SIMANIO
123 #export PATH=${SIMANIO_ROOT_DIR}/lib:${PATH}
124 export LD_LIBRARY_PATH=${SIMANIO_ROOT_DIR}/lib:${LD_LIBRARY_PATH}
125
126 export SIMAN_WS_HOST="172.22.0.100:8080"
127 echo "SIMAN_WS_HOST = ${SIMAN_WS_HOST}"
128
129 export SimanSalome_DIR="/tmp/SimanSalome/${1##*=}/${2##*=}/${3##*=}/"
130
131 mkdir -p ${SimanSalome_DIR} 
132 chmod -Rf g+w /tmp/SimanSalome
133
134 echo
135 echo "SimanSalome_DIR = ${SimanSalome_DIR}"
136
137 cd ${SimanSalome_DIR}
138
139 echo
140 echo "pwd = " `pwd`
141 echo "display = " ${DISPLAY}
142
143 echo
144 echo ">>> SALOME-SIMAN running"
145
146 #modules="KERNEL,GEOM,MED,SMESH,PARAVIS,YACS,CASTEM"
147 modules="KERNEL,GEOM,MED,SMESH,PARAVIS,YACS,YACSGEN,EFICAS,ASTER,SYRTHES"
148
149 export NOT_INTERCEPT_SIGNALS=1
150
151 #runSalome --siman $1 $2 $3 -k 
152 runSalome --siman $1 $2 $3 --modules=$modules
153
154 rc=$?
155 if [[ $rc != 0 ]] ; then
156     echo "SALOME-SIMAN running problem. Please check the script parameters".
157     exit $rc
158 fi
159
160 cd ${SALOME_ROOT_DIR}
161 rm -rf "/tmp/SimanSalome/${1##*=}/${2##*=}"
162
163 echo
164 echo = = = = =