[771] | 1 | #!/bin/ksh |
---|
| 2 | |
---|
| 3 | #************************************************************** |
---|
| 4 | # Author: Sébastien Denvil |
---|
| 5 | # Contact: Sebastien.Denvil__at__ipsl.jussieu.fr |
---|
| 6 | # $Revision:: $ Revision of last commit |
---|
| 7 | # $Author:: $ Author of last commit |
---|
| 8 | # $Date:: $ Date of last commit |
---|
| 9 | # IPSL (2006) |
---|
| 10 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
| 11 | # |
---|
| 12 | #************************************************************** |
---|
| 13 | |
---|
| 14 | #========================================================= |
---|
| 15 | # The documentation of this file can be automatically generated |
---|
| 16 | # if you use the prefix #D- for comments to be extracted. |
---|
| 17 | # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" |
---|
| 18 | #========================================================= |
---|
| 19 | |
---|
| 20 | #D-#================================================== |
---|
| 21 | #D-LibIGCM_sys for Ada |
---|
| 22 | #D-#================================================== |
---|
| 23 | #D- |
---|
| 24 | #D- This ksh library if a layer under some usefull |
---|
| 25 | #D-environment variables and shell commands. |
---|
| 26 | #D-All those definitions depend on host particularities. |
---|
| 27 | #D-It manages a stack mechanism and test validity of operations. |
---|
| 28 | #D-All function described bellow must be prefixed by IGCM_sys. |
---|
| 29 | |
---|
| 30 | #==================================================== |
---|
| 31 | # libIGCM_sys PARAMETERS |
---|
| 32 | #==================================================== |
---|
| 33 | |
---|
| 34 | #==================================================== |
---|
| 35 | # set DEBUG_sys to true to output calls of function |
---|
| 36 | typeset -r DEBUG_sys=${DEBUG_sys:=true} |
---|
| 37 | |
---|
| 38 | #==================================================== |
---|
| 39 | # Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get) |
---|
| 40 | typeset -r DRYRUN=${DRYRUN:=0} |
---|
| 41 | |
---|
| 42 | # YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE ! |
---|
| 43 | # ------------------------------------------------------------------------------------- |
---|
| 44 | # | DRYRUN= | Date computations, | sys_Get | Exe | sys_Put_Out; sys_Put_Rest | |
---|
[809] | 45 | # | | Cp/Exe/param/files | | | | |
---|
| 46 | # | | Chmod Qsub | | | | |
---|
[771] | 47 | # ------------------------------------------------------------------------------------- |
---|
| 48 | # | 0 | yes | yes | yes | yes | |
---|
| 49 | # ------------------------------------------------------------------------------------- |
---|
| 50 | # | 1 | yes | yes | yes | no | |
---|
| 51 | # ------------------------------------------------------------------------------------- |
---|
| 52 | # | 2 | yes | yes | no | no | |
---|
| 53 | # ------------------------------------------------------------------------------------- |
---|
| 54 | # | 3 | yes | no | no | no | |
---|
| 55 | # ------------------------------------------------------------------------------------- |
---|
| 56 | |
---|
| 57 | #===================================================== |
---|
| 58 | # Global Variables : |
---|
| 59 | #===================================================== |
---|
| 60 | # Language : "fr" or "en" |
---|
| 61 | typeset -r MYLANG="fr" |
---|
| 62 | |
---|
| 63 | #===================================================== |
---|
| 64 | # Host and user names |
---|
| 65 | # $hostname ou hostname |
---|
[1179] | 66 | typeset HOST=${HOST:=$( hostname )} |
---|
[771] | 67 | # $username ou whoami |
---|
[1179] | 68 | typeset LOGIN=${LOGIN:=$( whoami )} |
---|
[771] | 69 | # $hostname of the MASTER job |
---|
| 70 | typeset MASTER=ada |
---|
| 71 | |
---|
| 72 | #D- |
---|
| 73 | #D-#================================================== |
---|
| 74 | #D-Program used in libIGCM |
---|
| 75 | #D-#================================================== |
---|
| 76 | |
---|
| 77 | # Submit command |
---|
| 78 | typeset SUBMIT=${SUBMIT:=llsubmit} |
---|
| 79 | # rsync with path |
---|
| 80 | typeset -r RSYNC=/usr/bin/rsync |
---|
| 81 | # RSYNC_opt args to rsync |
---|
| 82 | typeset -r RSYNC_opt="-va" |
---|
| 83 | # ie storage filesystem |
---|
[1012] | 84 | typeset -r STOREHOST=ergon |
---|
[771] | 85 | typeset -r REMOTE_RSYNC=/u/rech/ces/rces452/RSYNC/bin/rsync |
---|
| 86 | |
---|
| 87 | #==================================================== |
---|
| 88 | # Set environment tools (ferret, nco, cdo) |
---|
| 89 | #==================================================== |
---|
[993] | 90 | source /smplocal/pub/Modules/default/init/ksh |
---|
[996] | 91 | . /smphome/rech/psl/rpsl035/.atlas_env_ada_bash > /dev/null 2>&1 |
---|
[993] | 92 | export PATH=${PATH}:/smphome/rech/psl/rpsl035/AddNoise/src_X64_ADA/bin |
---|
[1026] | 93 | export PATH=${PATH}:/smphome/rech/psl/rpsl035/AddPerturbation/src_X64_ADA/bin |
---|
[1179] | 94 | export PATH=${PATH}:/smphome/rech/psl/rpsl035/bin/ |
---|
[771] | 95 | |
---|
| 96 | #==================================================== |
---|
| 97 | # Host specific DIRECTORIES |
---|
| 98 | #==================================================== |
---|
| 99 | |
---|
| 100 | #==================================================== |
---|
| 101 | #- MirrorlibIGCM for frontend |
---|
| 102 | typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} |
---|
| 103 | |
---|
| 104 | #==================================================== |
---|
| 105 | #- libIGCM_POST for frontend |
---|
| 106 | typeset -r libIGCM_POST=${libIGCM} |
---|
| 107 | |
---|
| 108 | #==================================================== |
---|
| 109 | #- R_EXE (==> BIN_DIR = ${MODIPSL}/bin ) |
---|
| 110 | typeset -r R_EXE="${MODIPSL}/bin" |
---|
| 111 | |
---|
| 112 | #==================================================== |
---|
| 113 | #- SUBMIT_DIR : submission dir |
---|
[1012] | 114 | typeset -x SUBMIT_DIR=${SUBMIT_DIR:=${LOADL_STEP_INITDIR}} |
---|
[771] | 115 | |
---|
| 116 | #==================================================== |
---|
| 117 | #- IN |
---|
| 118 | typeset -r R_IN=${R_IN:=/workgpfs/rech/psl/rpsl035/IGCM} |
---|
| 119 | typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/u/rech/psl/rpsl376} |
---|
| 120 | |
---|
| 121 | #==================================================== |
---|
| 122 | #- RUN_DIR_PATH : Temporary working directory (=> TMP) |
---|
| 123 | typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${TMPDIR}} |
---|
| 124 | |
---|
| 125 | #==================================================== |
---|
[1179] | 126 | #- OUTCOMMAND_PATH : tmp place to store command lines standard error and outputs |
---|
| 127 | OUTCOMMAND_PATH=${RUN_DIR_PATH} |
---|
| 128 | |
---|
| 129 | #==================================================== |
---|
[771] | 130 | #- HOST_MPIRUN_COMMAND |
---|
[791] | 131 | typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="/usr/bin/time poe"} |
---|
[771] | 132 | |
---|
| 133 | #==================================================== |
---|
| 134 | #- Max number of arguments passed to nco operator or demigration command |
---|
| 135 | UNIX_MAX_LIMIT=360 |
---|
| 136 | |
---|
| 137 | #==================================================== |
---|
[1057] | 138 | #- set PackDefault true on ada |
---|
[771] | 139 | PackDefault=true |
---|
| 140 | |
---|
| 141 | #==================================================== |
---|
| 142 | #- Number of core per node (max number of OpenMP task) |
---|
| 143 | NUM_COREPERNODE=8 |
---|
| 144 | |
---|
| 145 | #==================================================== |
---|
| 146 | #- Default number of MPI task for IPSL coupled model |
---|
| 147 | #- required for backward compatibility |
---|
| 148 | #- |
---|
| 149 | DEFAULT_NUM_PROC_OCE=5 |
---|
| 150 | DEFAULT_NUM_PROC_CPL=1 |
---|
| 151 | (( DEFAULT_NUM_PROC_ATM = BATCH_NUM_PROC_TOT - DEFAULT_NUM_PROC_OCE - DEFAULT_NUM_PROC_CPL )) |
---|
| 152 | DEFAULT_NUM_PROC_TOTAL=${BATCH_NUM_PROC_TOT} |
---|
| 153 | |
---|
| 154 | #D-#================================================== |
---|
[1057] | 155 | #D-function IGCM_sys_defineArchives |
---|
| 156 | #D-* Purpose: |
---|
| 157 | #D-* Define ARCHIVE : Dedicated to large files |
---|
| 158 | #D-* Define STORAGE : Dedicated to small/medium files |
---|
| 159 | #D-* Define R_OUT : Output tree located on ARCHIVE |
---|
| 160 | #D-* Define R_FIG : Output tree located on STORAGE hosting figures (monitoring and atlas, and/or small files) |
---|
| 161 | #D-* Define R_BUF : Output tree located on SCRATCHDIR hosting files waiting for rebuild or pack processes |
---|
| 162 | #D-* if SpaceName=TEST everything is stored on WORKDIR |
---|
[771] | 163 | #D-* Examples: |
---|
| 164 | #D- |
---|
[1057] | 165 | function IGCM_sys_defineArchives { |
---|
| 166 | IGCM_debug_PushStack "IGCM_sys_defineArchives" |
---|
[771] | 167 | |
---|
[1060] | 168 | if [ ! X${config_UserChoices_ARCHIVE} = X ]; then |
---|
[1057] | 169 | #==================================================== |
---|
| 170 | #- ARCHIVE (dedicated to large files) |
---|
[1063] | 171 | ARCHIVE=${config_UserChoices_ARCHIVE} |
---|
[1057] | 172 | else |
---|
| 173 | #==================================================== |
---|
| 174 | #- ARCHIVE (dedicated to large files) |
---|
[1063] | 175 | ARCHIVE=$(echo ${HOME} | sed -e "s,/.*home/,/arch/home/,") |
---|
[1057] | 176 | fi |
---|
[771] | 177 | |
---|
[1060] | 178 | if [ ! X${config_UserChoices_STORAGE} = X ]; then |
---|
[1057] | 179 | #==================================================== |
---|
| 180 | #- STORAGE (dedicated to small/medium files) |
---|
[1063] | 181 | STORAGE=${config_UserChoices_STORAGE} |
---|
[1057] | 182 | else |
---|
| 183 | #==================================================== |
---|
| 184 | #- STORAGE (dedicated to small/medium files) |
---|
[1063] | 185 | STORAGE=${WORKDIR} |
---|
[1057] | 186 | fi |
---|
[771] | 187 | |
---|
[1057] | 188 | if [ X${config_UserChoices_SpaceName} = XTEST ]; then |
---|
| 189 | #==================================================== |
---|
| 190 | #- R_OUT |
---|
[1063] | 191 | R_OUT=${WORKDIR}/IGCM_OUT |
---|
[1057] | 192 | |
---|
| 193 | #==================================================== |
---|
| 194 | #- R_FIG (hosting figures : monitoring and atlas, and/or small files) |
---|
[1063] | 195 | R_FIG=${WORKDIR}/IGCM_OUT |
---|
[1057] | 196 | |
---|
| 197 | IGCM_debug_Print 1 "SpaceName=TEST ==> OVERRULE destination path directories" |
---|
| 198 | |
---|
| 199 | else |
---|
| 200 | #==================================================== |
---|
| 201 | #- R_OUT |
---|
[1063] | 202 | R_OUT=${ARCHIVE}/IGCM_OUT |
---|
[1057] | 203 | |
---|
| 204 | #==================================================== |
---|
| 205 | #- R_FIG (hosting figures : monitoring and atlas, and/or small files) |
---|
[1063] | 206 | R_FIG=${ARCHIVE}/IGCM_OUT |
---|
[1057] | 207 | fi |
---|
| 208 | |
---|
| 209 | #==================================================== |
---|
| 210 | #- R_BUF (ONLY FOR double copy an scratch) |
---|
[1063] | 211 | R_BUF=${WORKDIR}/IGCM_OUT |
---|
[1057] | 212 | |
---|
| 213 | IGCM_debug_Print 1 "R_OUT has been defined = ${R_OUT}" |
---|
| 214 | IGCM_debug_Print 1 "R_BUF has been defined = ${R_BUF}" |
---|
| 215 | IGCM_debug_Print 1 "R_FIG has been defined = ${R_FIG}" |
---|
| 216 | |
---|
| 217 | IGCM_debug_PopStack "IGCM_sys_defineArchives" |
---|
[771] | 218 | } |
---|
| 219 | |
---|
| 220 | #D-#================================================== |
---|
| 221 | #D-function IGCM_sys_RshMaster |
---|
| 222 | #D-* Purpose: Connection to frontend machine. |
---|
| 223 | #D-* Examples: |
---|
| 224 | #D- |
---|
| 225 | function IGCM_sys_RshMaster { |
---|
| 226 | IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ |
---|
[1179] | 227 | OUTCOMMAND_PATH=${OUTCOMMAND_PATH} /bin/ksh <<-EOF |
---|
[771] | 228 | export libIGCM=${libIGCM} |
---|
| 229 | export DEBUG_debug=${DEBUG_debug} |
---|
| 230 | . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh |
---|
| 231 | . ${libIGCM}/libIGCM_card/libIGCM_card.ksh |
---|
| 232 | ${@} |
---|
| 233 | EOF |
---|
| 234 | if [ $? -gt 0 ] ; then |
---|
| 235 | echo "IGCM_sys_RshMaster : erreur." |
---|
| 236 | IGCM_debug_Exit "IGCM_sys_RshMaster" |
---|
| 237 | fi |
---|
| 238 | IGCM_debug_PopStack "IGCM_sys_RshMaster" |
---|
| 239 | } |
---|
| 240 | |
---|
| 241 | #D-#================================================== |
---|
| 242 | #D-function IGCM_sys_RshArchive |
---|
| 243 | #D-* Purpose: Archive rsh command |
---|
| 244 | #D-* Examples: |
---|
| 245 | #D- |
---|
| 246 | function IGCM_sys_RshArchive { |
---|
| 247 | IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ |
---|
[798] | 248 | DEBUG_sys=false IGCM_sys_IsFileArchived "$@" |
---|
[1179] | 249 | if [ $? = 0 ] ; then |
---|
[798] | 250 | rsh ${STOREHOST} exec /bin/ksh <<-EOF |
---|
[771] | 251 | ${@} |
---|
| 252 | EOF |
---|
[798] | 253 | status=$? |
---|
| 254 | else |
---|
| 255 | /bin/ksh <<-EOF |
---|
| 256 | ${@} |
---|
| 257 | EOF |
---|
| 258 | status=$? |
---|
| 259 | fi |
---|
| 260 | if [ ${status} -gt 0 ] ; then |
---|
| 261 | IGCM_debug_Print 2 "IGCM_sys_RshArchive : rsh or command failed error code ${status}" |
---|
[771] | 262 | IGCM_debug_Exit "IGCM_sys_RshArchive" |
---|
| 263 | fi |
---|
| 264 | IGCM_debug_PopStack "IGCM_sys_RshArchive" |
---|
| 265 | } |
---|
| 266 | |
---|
| 267 | #D-#================================================== |
---|
[845] | 268 | #D-function IGCM_sys_RshArchive_NoError |
---|
| 269 | #D-* Purpose: Archive rsh command, without error |
---|
| 270 | #D-* used only in monitoring.job |
---|
| 271 | #D-* Examples: |
---|
| 272 | #D- |
---|
| 273 | function IGCM_sys_RshArchive_NoError { |
---|
| 274 | IGCM_debug_PushStack "IGCM_sys_RshArchive_NoError" $@ |
---|
| 275 | DEBUG_sys=false IGCM_sys_IsFileArchived "$@" |
---|
| 276 | if [ $? = 0 ] ; then |
---|
| 277 | rsh ${STOREHOST} exec /bin/ksh <<-EOF |
---|
| 278 | ${@} 2> /dev/null |
---|
| 279 | EOF |
---|
| 280 | else |
---|
| 281 | /bin/ksh <<-EOF |
---|
| 282 | ${@} 2> /dev/null |
---|
| 283 | EOF |
---|
| 284 | fi |
---|
| 285 | IGCM_debug_PopStack "IGCM_sys_RshArchive_NoError" |
---|
| 286 | } |
---|
| 287 | |
---|
| 288 | #D-#================================================== |
---|
[771] | 289 | #D-function IGCM_sys_RshPost |
---|
| 290 | #D-* Purpose: Post-process rsh command |
---|
| 291 | #D-* Examples: |
---|
| 292 | #D- |
---|
| 293 | function IGCM_sys_RshPost { |
---|
| 294 | IGCM_debug_PushStack "IGCM_sys_RshPost" $@ |
---|
| 295 | if ( $DEBUG_sys ) ; then |
---|
| 296 | echo "IGCM_sys_RshPost :" $@ |
---|
| 297 | fi |
---|
[811] | 298 | # keep standard input (stdin) for the loop onto temporary file |
---|
[1179] | 299 | cat >${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME} |
---|
[771] | 300 | |
---|
[1179] | 301 | OUTCOMMAND_PATH=${OUTCOMMAND_PATH} /bin/ksh <${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME} |
---|
[771] | 302 | if [ $? -gt 0 ] ; then |
---|
| 303 | echo "IGCM_sys_RshPost : erreur." |
---|
| 304 | IGCM_debug_Exit "IGCM_sys_RshPost" |
---|
| 305 | fi |
---|
| 306 | # delete temporary file |
---|
[1179] | 307 | \rm ${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME} |
---|
[771] | 308 | |
---|
| 309 | IGCM_debug_PopStack "IGCM_sys_RshPost" |
---|
| 310 | } |
---|
| 311 | |
---|
| 312 | #D-#================================================== |
---|
| 313 | #D-function IGCM_sys_SendMail |
---|
| 314 | #D-* Purpose: Send mail when simulation is over |
---|
| 315 | #D-* Examples: |
---|
| 316 | #D- |
---|
| 317 | function IGCM_sys_SendMail { |
---|
| 318 | IGCM_debug_PushStack "IGCM_sys_SendMail" $@ |
---|
| 319 | if ( $DEBUG_sys ) ; then |
---|
| 320 | echo "IGCM_sys_SendMail :" $@ |
---|
| 321 | fi |
---|
| 322 | |
---|
[922] | 323 | if [ X${1} = XAccounting ] ; then |
---|
| 324 | status=Accounting |
---|
| 325 | mailText=jobAccounting.mail |
---|
| 326 | elif ( ${ExitFlag} ) ; then |
---|
[771] | 327 | status=failed |
---|
[922] | 328 | mailText=jobEnd.mail |
---|
[771] | 329 | else |
---|
| 330 | status=completed |
---|
[922] | 331 | mailText=jobEnd.mail |
---|
[771] | 332 | fi |
---|
| 333 | |
---|
[922] | 334 | # Update selected mail template |
---|
| 335 | while read -r line; do |
---|
| 336 | eval echo $line >> mail.txt ; |
---|
| 337 | done < ${libIGCM}/libIGCM_sys/${mailText} |
---|
[771] | 338 | |
---|
| 339 | if [ ! -z ${config_UserChoices_MailName} ] ; then |
---|
[1179] | 340 | mail -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < mail.txt |
---|
[771] | 341 | elif [ -f ~/.forward ] ; then |
---|
[922] | 342 | mail -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < mail.txt |
---|
[771] | 343 | else |
---|
[922] | 344 | mail -s "${config_UserChoices_JobName} ${status}" ${USER} < mail.txt |
---|
[771] | 345 | fi |
---|
| 346 | |
---|
| 347 | sleep 10 |
---|
[922] | 348 | rm -f mail.txt |
---|
[771] | 349 | |
---|
| 350 | IGCM_debug_PopStack "IGCM_sys_SendMail" |
---|
| 351 | } |
---|
| 352 | |
---|
| 353 | #D-#================================================== |
---|
| 354 | #D-function IGCM_sys_Mkdir |
---|
| 355 | #D-* Purpose: Master locale mkdir command |
---|
| 356 | #D-* Examples: |
---|
| 357 | #D- |
---|
| 358 | function IGCM_sys_Mkdir { |
---|
| 359 | IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ |
---|
| 360 | if ( $DEBUG_sys ) ; then |
---|
| 361 | echo "IGCM_sys_Mkdir :" $@ |
---|
| 362 | fi |
---|
| 363 | if [ ! -d ${1} ]; then |
---|
| 364 | \mkdir -p $1 |
---|
| 365 | if [ $? -gt 0 ] ; then |
---|
| 366 | echo "IGCM_sys_Mkdir : erreur." |
---|
| 367 | IGCM_debug_Exit "IGCM_sys_Mkdir" |
---|
| 368 | fi |
---|
| 369 | fi |
---|
| 370 | # vérification : |
---|
| 371 | if [ ! -d ${1} ] ; then |
---|
| 372 | echo "IGCM_sys_Mkdir : erreur." |
---|
| 373 | IGCM_debug_Exit "IGCM_sys_Mkdir" |
---|
| 374 | fi |
---|
| 375 | IGCM_debug_PopStack "IGCM_sys_Mkdir" |
---|
| 376 | } |
---|
| 377 | |
---|
| 378 | #D-#================================================== |
---|
| 379 | #D-function IGCM_sys_MkdirArchive |
---|
| 380 | #D-* Purpose: Mkdir on Archive |
---|
| 381 | #D-* Examples: |
---|
| 382 | #D- |
---|
| 383 | function IGCM_sys_MkdirArchive { |
---|
| 384 | IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ |
---|
| 385 | if ( $DEBUG_sys ) ; then |
---|
| 386 | echo "IGCM_sys_MkdirArchive :" $@ |
---|
| 387 | fi |
---|
| 388 | #- creation de repertoire sur le serveur fichier |
---|
[798] | 389 | DEBUG_sys=false IGCM_sys_IsFileArchived $1 |
---|
[793] | 390 | if [ $? = 0 ] ; then |
---|
| 391 | rsh ${STOREHOST} -n mkdir -p $1 |
---|
[794] | 392 | status=$? |
---|
[793] | 393 | else |
---|
| 394 | mkdir -p $1 |
---|
[794] | 395 | status=$? |
---|
[922] | 396 | fi |
---|
[771] | 397 | |
---|
[794] | 398 | if [ ${status} -gt 0 ] ; then |
---|
| 399 | IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : rsh or mkdir failed error code ${status}" |
---|
[771] | 400 | IGCM_debug_Exit "IGCM_sys_MkdirArchive" |
---|
| 401 | fi |
---|
| 402 | IGCM_debug_PopStack "IGCM_sys_MkdirArchive" |
---|
| 403 | } |
---|
| 404 | |
---|
| 405 | #D-#================================================== |
---|
| 406 | #D-function IGCM_sys_MkdirWork |
---|
| 407 | #D-* Purpose: Mkdir on Work |
---|
| 408 | #D-* Examples: |
---|
| 409 | #D- |
---|
| 410 | function IGCM_sys_MkdirWork { |
---|
| 411 | IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ |
---|
| 412 | if ( $DEBUG_sys ) ; then |
---|
| 413 | echo "IGCM_sys_MkdirWork :" $@ |
---|
| 414 | fi |
---|
| 415 | #- creation de repertoire sur le serveur fichier |
---|
| 416 | if [ ! -d ${1} ]; then |
---|
| 417 | \mkdir -p $1 |
---|
| 418 | if [ $? -gt 0 ] ; then |
---|
| 419 | echo "IGCM_sys_MkdirWork : erreur." |
---|
| 420 | IGCM_debug_Exit "IGCM_sys_MkdirWork" |
---|
| 421 | fi |
---|
| 422 | fi |
---|
| 423 | IGCM_debug_PopStack "IGCM_sys_MkdirWork" |
---|
| 424 | } |
---|
| 425 | |
---|
| 426 | #D-#================================================== |
---|
| 427 | #D-function IGCM_sys_Cd |
---|
| 428 | #D-* Purpose: master cd command |
---|
| 429 | #D-* Examples: |
---|
| 430 | #D- |
---|
| 431 | function IGCM_sys_Cd { |
---|
| 432 | IGCM_debug_PushStack "IGCM_sys_Cd" $@ |
---|
| 433 | if ( $DEBUG_sys ) ; then |
---|
| 434 | echo "IGCM_sys_Cd :" $@ |
---|
| 435 | fi |
---|
| 436 | \cd $1 |
---|
| 437 | if [ $? -gt 0 ] ; then |
---|
| 438 | echo "IGCM_sys_Cd : erreur." |
---|
| 439 | IGCM_debug_Exit "IGCM_sys_Cd" |
---|
| 440 | fi |
---|
| 441 | IGCM_debug_PopStack "IGCM_sys_Cd" |
---|
| 442 | } |
---|
| 443 | |
---|
| 444 | #D-#================================================== |
---|
| 445 | #D-function IGCM_sys_Chmod |
---|
| 446 | #D-* Purpose: Chmod |
---|
| 447 | #D-* Examples: |
---|
| 448 | #D- |
---|
| 449 | function IGCM_sys_Chmod { |
---|
[1057] | 450 | IGCM_debug_PushStack "IGCM_sys_Chmod" $@ |
---|
[771] | 451 | if ( $DEBUG_sys ) ; then |
---|
| 452 | echo "IGCM_sys_Chmod :" $@ |
---|
| 453 | fi |
---|
[809] | 454 | \chmod $@ |
---|
| 455 | if [ $? -gt 0 ] ; then |
---|
| 456 | echo "IGCM_sys_Chmod : erreur." |
---|
| 457 | IGCM_debug_Exit "IGCM_sys_Chmod" |
---|
[771] | 458 | fi |
---|
| 459 | IGCM_debug_PopStack "IGCM_sys_Chmod" |
---|
| 460 | } |
---|
| 461 | |
---|
| 462 | #D-#================================================== |
---|
| 463 | #D-function IGCM_sys_FileSize |
---|
| 464 | #D-* Purpose: Filesize |
---|
| 465 | #D-* Examples: |
---|
| 466 | #D- |
---|
| 467 | function IGCM_sys_FileSize { |
---|
| 468 | IGCM_debug_PushStack "IGCM_sys_FileSize" $@ |
---|
| 469 | |
---|
| 470 | typeset sizeF |
---|
| 471 | set +A sizeF -- $( ls -la ${1} ) |
---|
| 472 | if [ $? -gt 0 ] ; then |
---|
| 473 | IGCM_debug_Exit "IGCM_sys_FileSize" |
---|
| 474 | fi |
---|
| 475 | eval ${2}=${sizeF[4]} |
---|
| 476 | |
---|
| 477 | IGCM_debug_PopStack "IGCM_sys_FileSize" |
---|
| 478 | } |
---|
| 479 | |
---|
| 480 | #D-#================================================== |
---|
| 481 | #D-function IGCM_sys_TestDir |
---|
| 482 | #D-* Purpose: Test Directory that must exists |
---|
| 483 | #D-* Examples: |
---|
| 484 | #D- |
---|
| 485 | function IGCM_sys_TestDir { |
---|
| 486 | IGCM_debug_PushStack "IGCM_sys_TestDir" $@ |
---|
| 487 | if ( $DEBUG_sys ) ; then |
---|
| 488 | echo "IGCM_sys_TestDir :" $@ |
---|
| 489 | fi |
---|
| 490 | typeset ExistFlag |
---|
| 491 | ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) |
---|
| 492 | IGCM_debug_PopStack "IGCM_sys_TestDir" |
---|
| 493 | |
---|
| 494 | return ${ExistFlag} |
---|
| 495 | } |
---|
| 496 | |
---|
| 497 | #D-#================================================== |
---|
| 498 | #D-function IGCM_sys_TestDirArchive |
---|
| 499 | #D-* Purpose: Test Directory that must exists on Archive |
---|
| 500 | #D-* Examples: |
---|
| 501 | #D- |
---|
| 502 | function IGCM_sys_TestDirArchive { |
---|
| 503 | IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ |
---|
| 504 | if ( $DEBUG_sys ) ; then |
---|
| 505 | echo "IGCM_sys_TestDirArchive :" $@ |
---|
| 506 | fi |
---|
[1027] | 507 | typeset ExistFlag |
---|
[796] | 508 | #Command depends on targeted file system |
---|
[798] | 509 | DEBUG_sys=false IGCM_sys_IsFileArchived $1 |
---|
[796] | 510 | if [ $? = 0 ] ; then |
---|
[1027] | 511 | ExistFlag=$( IGCM_sys_RshArchive "[ -d $1 ] && echo 0 || echo 1" ) |
---|
[796] | 512 | else |
---|
[1027] | 513 | ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) |
---|
[796] | 514 | fi |
---|
[771] | 515 | IGCM_debug_PopStack "IGCM_sys_TestDirArchive" |
---|
| 516 | return ${ExistFlag} |
---|
| 517 | } |
---|
| 518 | |
---|
| 519 | #D-#================================================== |
---|
| 520 | #D-function IGCM_sys_IsFileArchived |
---|
[1012] | 521 | #D-* Purpose: Test file that must NOT EXISTS on Archive based on filename only |
---|
[771] | 522 | #D-* Examples: |
---|
| 523 | #D- |
---|
| 524 | function IGCM_sys_IsFileArchived { |
---|
| 525 | IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@ |
---|
| 526 | if ( $DEBUG_sys ) ; then |
---|
| 527 | echo "IGCM_sys_IsFileArchived :" $@ |
---|
| 528 | fi |
---|
| 529 | typeset IsArchivedFlag |
---|
[1171] | 530 | IsArchivedFlag=$( [ "X$( echo $@ | grep \/arch\/home )" != "X" ] && echo 0 || echo 1 ) |
---|
[771] | 531 | IGCM_debug_PopStack "IGCM_sys_IsFileArchived" |
---|
| 532 | |
---|
| 533 | return ${IsArchivedFlag} |
---|
| 534 | } |
---|
| 535 | |
---|
| 536 | #D-#================================================== |
---|
| 537 | #D-function IGCM_sys_TestFileArchive |
---|
| 538 | #D-* Purpose: Test file that must NOT EXISTS on Archive |
---|
| 539 | #D-* Examples: |
---|
| 540 | #D- |
---|
[1148] | 541 | function IGCM_sys_TestFileArchive { |
---|
| 542 | IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ |
---|
[1179] | 543 | typeset ExistFlag |
---|
[1171] | 544 | ExistFlag=$( IGCM_sys_RshArchive "[ -f $1 ] && echo 0 || echo 1" ) |
---|
[1148] | 545 | IGCM_debug_PopStack "IGCM_sys_TestFileArchive" |
---|
| 546 | |
---|
| 547 | return ${ExistFlag} |
---|
| 548 | } |
---|
| 549 | |
---|
| 550 | #D-#================================================== |
---|
[771] | 551 | #D-function IGCM_sys_TestFileBuffer |
---|
| 552 | #D-* Purpose: Test file that must NOT EXISTS on Buffer |
---|
| 553 | #D-* Examples: |
---|
| 554 | #D- |
---|
| 555 | function IGCM_sys_TestFileBuffer { |
---|
| 556 | IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ |
---|
| 557 | typeset ExistFlag |
---|
| 558 | ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) |
---|
| 559 | IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" |
---|
| 560 | |
---|
| 561 | return ${ExistFlag} |
---|
| 562 | } |
---|
| 563 | |
---|
[1179] | 564 | #D-#================================================== |
---|
| 565 | #D-function IGCM_sys_CountFileArchive |
---|
| 566 | #D-* Purpose: Count files on Archive filesystem |
---|
| 567 | #D-* Examples: |
---|
| 568 | #D- |
---|
[1148] | 569 | function IGCM_sys_CountFileArchive { |
---|
| 570 | IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ |
---|
| 571 | #Command depends on targeted file system |
---|
| 572 | DEBUG_sys=false IGCM_sys_IsFileArchived $1 |
---|
| 573 | if [ $? = 0 ] ; then |
---|
| 574 | IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l" |
---|
| 575 | status=$? |
---|
| 576 | else |
---|
| 577 | ls ${@} 2>/dev/null | wc -l |
---|
| 578 | status=$? |
---|
| 579 | fi |
---|
| 580 | if [ ${status} -gt 0 ] ; then |
---|
| 581 | echo "IGCM_sys_CountFileArchive : erreur." |
---|
| 582 | fi |
---|
| 583 | IGCM_debug_PopStack "IGCM_sys_CountFileArchive" |
---|
| 584 | } |
---|
| 585 | |
---|
| 586 | #D-#================================================== |
---|
[771] | 587 | #D-function IGCM_sys_CountFileBuffer |
---|
| 588 | #D-* Purpose: Count files on Scratch filesystem |
---|
| 589 | #D-* Examples: |
---|
| 590 | #D- |
---|
| 591 | function IGCM_sys_CountFileBuffer { |
---|
| 592 | IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ |
---|
| 593 | ls ${@} 2>/dev/null | wc -l |
---|
| 594 | if [ $? -gt 0 ] ; then |
---|
| 595 | echo "IGCM_sys_CountFileBuffer : erreur." |
---|
| 596 | fi |
---|
| 597 | IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" |
---|
| 598 | } |
---|
| 599 | |
---|
| 600 | #D-#================================================== |
---|
| 601 | #D-function IGCM_sys_Tree |
---|
| 602 | #D-* Purpose: Tree directories with files on ${ARCHIVE} |
---|
| 603 | #D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT} |
---|
| 604 | #D- |
---|
| 605 | function IGCM_sys_Tree { |
---|
| 606 | IGCM_debug_PushStack "IGCM_sys_Tree" $@ |
---|
| 607 | if ( $DEBUG_sys ) ; then |
---|
| 608 | echo "IGCM_sys_Tree :" $@ |
---|
| 609 | fi |
---|
| 610 | |
---|
[1032] | 611 | \mfls -R $@ |
---|
[771] | 612 | |
---|
| 613 | IGCM_debug_PopStack "IGCM_sys_Tree" |
---|
| 614 | } |
---|
| 615 | |
---|
| 616 | #D-#================================================== |
---|
| 617 | #D-function IGCM_sys_Tar |
---|
| 618 | #D-* Purpose: master tar command |
---|
| 619 | #D-* Examples: |
---|
| 620 | #D- |
---|
| 621 | function IGCM_sys_Tar { |
---|
| 622 | IGCM_debug_PushStack "IGCM_sys_Tar" $@ |
---|
| 623 | if ( $DEBUG_sys ) ; then |
---|
| 624 | echo "IGCM_sys_Tar :" $@ |
---|
| 625 | fi |
---|
| 626 | \tar cf $@ |
---|
| 627 | if [ $? -gt 0 ] ; then |
---|
| 628 | echo "IGCM_sys_Tar : erreur." |
---|
| 629 | IGCM_debug_Exit "IGCM_sys_Tar" |
---|
| 630 | fi |
---|
| 631 | IGCM_debug_PopStack "IGCM_sys_Tar" |
---|
| 632 | } |
---|
| 633 | |
---|
| 634 | #D-#================================================== |
---|
| 635 | #D-function IGCM_sys_UnTar |
---|
| 636 | #D-* Purpose: master un-tar command |
---|
| 637 | #D-* Examples: |
---|
| 638 | #D- |
---|
| 639 | function IGCM_sys_UnTar { |
---|
| 640 | IGCM_debug_PushStack "IGCM_sys_UnTar" $@ |
---|
| 641 | if ( $DEBUG_sys ) ; then |
---|
| 642 | echo "IGCM_sys_UnTar :" $@ |
---|
| 643 | fi |
---|
| 644 | \tar xvf $1 |
---|
| 645 | if [ $? -gt 0 ] ; then |
---|
| 646 | echo "IGCM_sys_UnTar : erreur." |
---|
| 647 | IGCM_debug_Exit "IGCM_sys_UnTar" |
---|
| 648 | fi |
---|
| 649 | IGCM_debug_PopStack "IGCM_sys_UnTar" |
---|
| 650 | } |
---|
| 651 | |
---|
| 652 | #D-#================================================== |
---|
| 653 | #D-function IGCM_sys_Qsub |
---|
| 654 | #D-* Purpose: Qsub new job |
---|
| 655 | #D-* Examples: |
---|
| 656 | #D- |
---|
| 657 | function IGCM_sys_Qsub { |
---|
| 658 | IGCM_debug_PushStack "IGCM_sys_Qsub" $@ |
---|
| 659 | if ( $DEBUG_sys ) ; then |
---|
| 660 | echo "IGCM_sys_Qsub :" $@ |
---|
| 661 | fi |
---|
[1179] | 662 | typeset status |
---|
| 663 | |
---|
[771] | 664 | # We have to change output/error file |
---|
| 665 | [ ${#@} = 1 ] && REP_FOR_JOB=${SUBMIT_DIR} |
---|
| 666 | [ ${#@} = 2 ] && REP_FOR_JOB=${2} |
---|
[774] | 667 | sed -e "s:\# \@ output *= .*:\# \@ output = ${Script_Output}:" \ |
---|
| 668 | -e "s:\# \@ error *= .*:\# \@ error = ${Script_Output}:" \ |
---|
| 669 | $1 > ${REP_FOR_JOB}/JOB_FOR_IGCM |
---|
[1179] | 670 | cd $REP_FOR_JOB ; /usr/bin/llsubmit JOB_FOR_IGCM > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 ; status=$? ; cd - ; |
---|
[771] | 671 | |
---|
[1179] | 672 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[811] | 673 | if [ ${status} -gt 0 ] ; then |
---|
| 674 | IGCM_debug_Print 2 "IGCM_sys_Qsub $1 : error code ${status}" |
---|
[771] | 675 | IGCM_debug_Exit "IGCM_sys_Qsub" |
---|
| 676 | else |
---|
[1179] | 677 | JobID=$( gawk {'print $4'} ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ | tail -1 | sed -e s/\"//g ) |
---|
[771] | 678 | IGCM_sys_Rm ${REP_FOR_JOB}/JOB_FOR_IGCM |
---|
| 679 | fi |
---|
| 680 | IGCM_debug_PopStack "IGCM_sys_Qsub" |
---|
| 681 | } |
---|
| 682 | |
---|
| 683 | #D-#================================================== |
---|
| 684 | #D-function IGCM_sys_QsubPost |
---|
| 685 | #D-* Purpose: Qsub new job on scalaire |
---|
| 686 | #D-* Examples: |
---|
| 687 | #D- |
---|
| 688 | function IGCM_sys_QsubPost { |
---|
| 689 | IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ |
---|
| 690 | if ( $DEBUG_sys ) ; then |
---|
| 691 | echo "IGCM_sys_QsubPost :" $@ |
---|
| 692 | fi |
---|
[1179] | 693 | typeset status |
---|
| 694 | |
---|
[771] | 695 | # We have to change output/error file |
---|
[784] | 696 | [ ${#@} = 1 ] && REP_FOR_JOB=${POST_DIR} |
---|
[771] | 697 | [ ${#@} = 2 ] && REP_FOR_JOB=${2} |
---|
| 698 | |
---|
[784] | 699 | sed -e "s:\# \@ output *= .*:\# \@ output = ${Script_Post_Output}.out:" \ |
---|
| 700 | -e "s:\# \@ error *= .*:\# \@ error = ${Script_Post_Output}.out:" \ |
---|
[887] | 701 | ${libIGCM_POST}/$1.job > ${REP_FOR_JOB}/JOB_FOR_IGCM_$$ |
---|
[774] | 702 | |
---|
[1179] | 703 | cd $REP_FOR_JOB ; /usr/bin/llsubmit JOB_FOR_IGCM_$$ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 ; status=$? ; cd - ; |
---|
[948] | 704 | |
---|
[1179] | 705 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[811] | 706 | if [ ${status} -gt 0 ] ; then |
---|
| 707 | IGCM_debug_Print 2 "IGCM_sys_QsubPost $1 : error code ${status}" |
---|
[771] | 708 | IGCM_debug_Exit "IGCM_sys_QsubPost" |
---|
| 709 | else |
---|
[1179] | 710 | JobID=$( gawk {'print $4'} ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ | tail -1 | sed -e s/\"//g ) |
---|
[887] | 711 | IGCM_sys_Rm ${REP_FOR_JOB}/JOB_FOR_IGCM_$$ |
---|
[771] | 712 | fi |
---|
| 713 | IGCM_debug_PopStack "IGCM_sys_QsubPost" |
---|
| 714 | } |
---|
| 715 | |
---|
| 716 | #D-************************* |
---|
| 717 | #D- File transfer functions |
---|
| 718 | #D-************************* |
---|
| 719 | #D- |
---|
| 720 | |
---|
| 721 | #D-#================================================== |
---|
| 722 | #D-function IGCM_sys_Rsync_out |
---|
| 723 | #D-* Purpose: treat return val of rsync |
---|
| 724 | #D-* Examples: IGCM_sys_Rsync_out out_RET_rsync |
---|
| 725 | #D- Error values and explanations can depend on your system version. |
---|
| 726 | function IGCM_sys_Rsync_out { |
---|
| 727 | status=$1 |
---|
| 728 | if [ ! $status ] ; then |
---|
| 729 | echo "rsync error !" |
---|
| 730 | fi |
---|
| 731 | |
---|
| 732 | if [ $MYLANG = "fr" ]; then |
---|
| 733 | case $status in |
---|
| 734 | 0) return ;; |
---|
| 735 | 1) echo "Erreur de rsync ; RERR_SYNTAX : " |
---|
| 736 | echo "Erreur de syntaxe ou d'utilisation." |
---|
| 737 | return;; |
---|
| 738 | 2) echo "Erreur de rsync ; RERR_PROTOCOL : " |
---|
| 739 | echo "Incompatibilité de protocole." |
---|
| 740 | return;; |
---|
| 741 | 3) echo "Erreur de rsync ; RERR_FILESELECT 3" |
---|
| 742 | echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" |
---|
| 743 | echo "répertoires" |
---|
| 744 | return;; |
---|
| 745 | 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" |
---|
| 746 | echo "Action demandée non supportée : une tentative de manipulation de" |
---|
| 747 | echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" |
---|
| 748 | echo "été faite ; ou une option qui est supportée par le client mais" |
---|
| 749 | echo "pas par le serveur a été spécifiée." |
---|
| 750 | return;; |
---|
| 751 | 10) echo "Erreur de rsync ; RERR_SOCKETIO" |
---|
| 752 | echo "Erreur dans le socket d'entrée sortie" |
---|
| 753 | return;; |
---|
| 754 | 11) echo "Erreur de rsync ; RERR_FILEIO" |
---|
| 755 | echo "Erreur d'entrée sortie fichier" |
---|
| 756 | return;; |
---|
| 757 | 12) echo "Erreur de rsync ; RERR_STREAMIO" |
---|
| 758 | echo "Erreur dans flux de donnée du protocole rsync" |
---|
| 759 | return;; |
---|
| 760 | 13) echo "Erreur de rsync ; RERR_MESSAGEIO" |
---|
| 761 | echo "Erreur avec les diagnostics du programme" |
---|
| 762 | return;; |
---|
| 763 | 14) echo "Erreur de rsync ; RERR_IPC" |
---|
| 764 | echo "Erreur dans le code IPC" |
---|
| 765 | return;; |
---|
| 766 | 20) echo "Erreur de rsync ; RERR_SIGNAL" |
---|
| 767 | echo "SIGUSR1 ou SIGINT reçu" |
---|
| 768 | return;; |
---|
| 769 | 21) echo "Erreur de rsync ; RERR_WAITCHILD" |
---|
| 770 | echo "Une erreur retournée par waitpid()" |
---|
| 771 | return;; |
---|
| 772 | 22) echo "Erreur de rsync ; RERR_MALLOC" |
---|
| 773 | echo "Erreur lors de l'allocation des tampons de mémoire de coeur" |
---|
| 774 | return;; |
---|
| 775 | 23) echo "" |
---|
| 776 | echo "Erreur fichier inexistant" |
---|
| 777 | return;; |
---|
| 778 | 30) echo "Erreur de rsync ; RERR_TIMEOUT" |
---|
| 779 | echo "Temps d'attente écoulé dans l'envoi/réception de données" |
---|
| 780 | return;; |
---|
| 781 | *) echo "Erreur de rsync : code de retour de rsync inconnu :" $status |
---|
| 782 | return;; |
---|
| 783 | esac |
---|
| 784 | elif [ $MYLANG = "en" ] ; then |
---|
| 785 | case $status in |
---|
| 786 | 0) return;; |
---|
| 787 | 1) echo "rsync error : Syntax or usage error " |
---|
| 788 | return;; |
---|
| 789 | 2) echo "rsync error : Protocol incompatibility " |
---|
| 790 | return;; |
---|
| 791 | 3) echo "rsync error : Errors selecting input/output files, dirs" |
---|
| 792 | return;; |
---|
| 793 | 4) echo "rsync error : Requested action not supported: an attempt" |
---|
| 794 | echo "was made to manipulate 64-bit files on a platform that cannot support" |
---|
| 795 | echo "them; or an option was specified that is supported by the client and" |
---|
| 796 | echo "not by the server." |
---|
| 797 | return;; |
---|
| 798 | 5) echo "rsync error : Error starting client-server protocol" |
---|
| 799 | return;; |
---|
| 800 | 10) echo "rsync error : Error in socket I/O " |
---|
| 801 | return;; |
---|
| 802 | 11) echo "rsync error : Error in file I/O " |
---|
| 803 | return;; |
---|
| 804 | 12) echo "rsync error : Error in rsync protocol data stream " |
---|
| 805 | return;; |
---|
| 806 | 13) echo "rsync error : Errors with program diagnostics " |
---|
| 807 | return;; |
---|
| 808 | 14) echo "rsync error : Error in IPC code " |
---|
| 809 | return;; |
---|
| 810 | 20) echo "rsync error : Received SIGUSR1 or SIGINT " |
---|
| 811 | return;; |
---|
| 812 | 21) echo "rsync error : Some error returned by waitpid() " |
---|
| 813 | return;; |
---|
| 814 | 22) echo "rsync error : Error allocating core memory buffers " |
---|
| 815 | return;; |
---|
| 816 | 23) echo "rsync error : Partial transfer due to error" |
---|
| 817 | return;; |
---|
| 818 | 24) echo "rsync error : Partial transfer due to vanished source files" |
---|
| 819 | return;; |
---|
| 820 | 30) echo "rsync error : Timeout in data send/receive " |
---|
| 821 | return;; |
---|
| 822 | *) echo "rsync error : return code of rsync unknown :" $status |
---|
| 823 | return;; |
---|
| 824 | esac |
---|
| 825 | else |
---|
| 826 | echo "unknown language $MYLANG." |
---|
| 827 | return |
---|
| 828 | fi |
---|
| 829 | } |
---|
| 830 | |
---|
| 831 | #D-#================================================== |
---|
| 832 | #D-function IGCM_sys_Miror_libIGCM |
---|
[811] | 833 | #D-* Purpose: Mirror libIGCM PATH and lib to frontend |
---|
[771] | 834 | #D-* Examples: |
---|
| 835 | #D- |
---|
| 836 | function IGCM_sys_Mirror_libIGCM { |
---|
| 837 | IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM" |
---|
| 838 | if ( $DEBUG_sys ) ; then |
---|
| 839 | echo "IGCM_sys_Mirror_libIGCM" |
---|
| 840 | fi |
---|
| 841 | |
---|
| 842 | typeset status |
---|
| 843 | |
---|
| 844 | mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} |
---|
| 845 | |
---|
[1179] | 846 | echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
| 847 | ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 848 | status=$? |
---|
| 849 | |
---|
| 850 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 851 | echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on frontend." |
---|
[1179] | 852 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 853 | fi |
---|
| 854 | IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" |
---|
| 855 | } |
---|
| 856 | |
---|
| 857 | #D-#================================================== |
---|
| 858 | #D-function IGCM_sys_Cp |
---|
| 859 | #D-* Purpose: generic cp |
---|
| 860 | #D-* Examples: |
---|
| 861 | #D- |
---|
| 862 | function IGCM_sys_Cp { |
---|
| 863 | IGCM_debug_PushStack "IGCM_sys_Cp" $@ |
---|
| 864 | if ( $DEBUG_sys ) ; then |
---|
| 865 | echo "IGCM_sys_Cp :" $@ |
---|
| 866 | fi |
---|
| 867 | |
---|
| 868 | typeset status |
---|
| 869 | |
---|
[1179] | 870 | echo cp $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
| 871 | \cp $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 872 | status=$? |
---|
| 873 | |
---|
| 874 | if [ ${status} -gt 0 ] ; then |
---|
| 875 | echo "IGCM_sys_Cp : error code ${status}" |
---|
[1179] | 876 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 877 | IGCM_debug_Exit "IGCM_sys_Cp" |
---|
| 878 | else |
---|
[1179] | 879 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 880 | fi |
---|
| 881 | IGCM_debug_PopStack "IGCM_sys_Cp" |
---|
| 882 | } |
---|
| 883 | |
---|
| 884 | #D-#================================================== |
---|
| 885 | #D-function IGCM_sys_Rm |
---|
| 886 | #D-* Purpose: generic rm |
---|
| 887 | #D-* Examples: |
---|
| 888 | #D- |
---|
| 889 | function IGCM_sys_Rm { |
---|
[1057] | 890 | IGCM_debug_PushStack "IGCM_sys_Rm" $@ |
---|
[771] | 891 | if ( $DEBUG_sys ) ; then |
---|
| 892 | echo "IGCM_sys_Rm :" $@ |
---|
| 893 | fi |
---|
| 894 | |
---|
| 895 | typeset status |
---|
| 896 | |
---|
[1179] | 897 | echo rm $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
| 898 | \rm $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 899 | status=$? |
---|
| 900 | |
---|
| 901 | if [ ${status} -gt 0 ] ; then |
---|
| 902 | echo "IGCM_sys_Rm : error code ${status}" |
---|
[1179] | 903 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 904 | IGCM_debug_Exit "IGCM_sys_Rm" |
---|
| 905 | else |
---|
[1179] | 906 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 907 | fi |
---|
| 908 | IGCM_debug_PopStack "IGCM_sys_Rm" |
---|
| 909 | } |
---|
| 910 | |
---|
| 911 | #D-#================================================== |
---|
| 912 | #D-function IGCM_sys_RmRunDir |
---|
| 913 | #D-* Purpose: rm tmpdir (dummy function most of the time batch |
---|
| 914 | #D- scheduler will do the job) |
---|
| 915 | #D-* Examples: |
---|
| 916 | #D- |
---|
| 917 | function IGCM_sys_RmRunDir { |
---|
[1057] | 918 | IGCM_debug_PushStack "IGCM_sys_RmRunDir" $@ |
---|
[771] | 919 | if ( $DEBUG_sys ) ; then |
---|
| 920 | echo "IGCM_sys_RmRunDir :" $@ |
---|
| 921 | echo "Dummy call, let the scheduler do that." |
---|
| 922 | fi |
---|
| 923 | IGCM_debug_PopStack "IGCM_sys_RmRunDir" |
---|
| 924 | } |
---|
| 925 | |
---|
| 926 | #D-#================================================== |
---|
| 927 | #D-function IGCM_sys_Mv |
---|
| 928 | #D-* Purpose: generic move |
---|
| 929 | #D-* Examples: |
---|
| 930 | #D- |
---|
| 931 | function IGCM_sys_Mv { |
---|
| 932 | IGCM_debug_PushStack "IGCM_sys_Mv" $@ |
---|
| 933 | if ( $DEBUG_sys ) ; then |
---|
| 934 | echo "IGCM_sys_Mv :" $@ |
---|
| 935 | fi |
---|
| 936 | |
---|
| 937 | if [ $DRYRUN = 0 ]; then |
---|
| 938 | |
---|
| 939 | typeset status |
---|
| 940 | |
---|
[1179] | 941 | echo mv $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
| 942 | \mv $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 943 | status=$? |
---|
| 944 | |
---|
| 945 | if [ ${status} -gt 0 ] ; then |
---|
| 946 | echo "IGCM_sys_Mv : error code ${status}" |
---|
[1179] | 947 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 948 | IGCM_debug_Exit "IGCM_sys_Mv" |
---|
| 949 | else |
---|
[1179] | 950 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 951 | fi |
---|
| 952 | fi |
---|
| 953 | |
---|
| 954 | IGCM_debug_PopStack "IGCM_sys_Mv" |
---|
| 955 | } |
---|
| 956 | |
---|
| 957 | #D-#================================================== |
---|
| 958 | #D-function IGCM_sys_Put_Dir |
---|
| 959 | #D-* Purpose: Copy a complete directory on $(ARCHIVE) |
---|
| 960 | #D-* Examples: |
---|
| 961 | #D- |
---|
| 962 | function IGCM_sys_Put_Dir { |
---|
| 963 | IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ |
---|
| 964 | if ( $DEBUG_sys ) ; then |
---|
| 965 | echo "IGCM_sys_Put_Dir :" $@ |
---|
| 966 | fi |
---|
| 967 | if [ $DRYRUN = 0 ]; then |
---|
| 968 | if [ ! -d ${1} ] ; then |
---|
| 969 | echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." |
---|
| 970 | IGCM_debug_PopStack "IGCM_sys_Put_Dir" |
---|
| 971 | return |
---|
| 972 | fi |
---|
| 973 | |
---|
| 974 | typeset status |
---|
| 975 | |
---|
| 976 | # Only if we use rsync |
---|
| 977 | #IGCM_sys_TestDirArchive $( dirname $2 ) |
---|
| 978 | # |
---|
[792] | 979 | #Command depends on targeted file system |
---|
[798] | 980 | DEBUG_sys=false IGCM_sys_IsFileArchived $2 |
---|
[792] | 981 | if [ $? = 0 ] ; then |
---|
[1179] | 982 | \rcp -r $1 ${STOREHOST}:$2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[792] | 983 | status=$? |
---|
| 984 | else |
---|
[1179] | 985 | \cp -r $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[792] | 986 | status=$? |
---|
| 987 | fi |
---|
[771] | 988 | |
---|
| 989 | if [ ${status} -gt 0 ] ; then |
---|
[792] | 990 | IGCM_debug_Print 2 "IGCM_sys_Put_Dir : rcp or cp failed error code ${status}" |
---|
[1179] | 991 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 992 | IGCM_debug_Exit "IGCM_sys_Put_Dir" |
---|
| 993 | else |
---|
[1179] | 994 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 995 | fi |
---|
| 996 | fi |
---|
| 997 | IGCM_debug_PopStack "IGCM_sys_Put_Dir" |
---|
| 998 | } |
---|
| 999 | |
---|
| 1000 | #D-#================================================== |
---|
| 1001 | #D-function IGCM_sys_Get_Dir |
---|
| 1002 | #D-* Purpose: Copy a complete directory from ${ARCHIVE} |
---|
| 1003 | #D-* Examples: |
---|
| 1004 | #D- |
---|
| 1005 | function IGCM_sys_Get_Dir { |
---|
| 1006 | IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ |
---|
| 1007 | if ( $DEBUG_sys ) ; then |
---|
| 1008 | echo "IGCM_sys_Get_Dir :" $@ |
---|
| 1009 | fi |
---|
| 1010 | if [ $DRYRUN = 0 ]; then |
---|
| 1011 | typeset NB_ESSAI DELAI status i |
---|
| 1012 | # number of tentative |
---|
| 1013 | NB_ESSAI=3 |
---|
| 1014 | # time delay between tentative |
---|
| 1015 | DELAI=2 |
---|
| 1016 | |
---|
| 1017 | # Only if we use rsync |
---|
| 1018 | #IGCM_sys_TestDirArchive $( dirname $2 ) |
---|
| 1019 | # |
---|
[793] | 1020 | # Command depends on targeted filesystem |
---|
[798] | 1021 | DEBUG_sys=false IGCM_sys_IsFileArchived $1 |
---|
[793] | 1022 | if [ $? = 0 ] ; then |
---|
| 1023 | # add dmget (to demigrate all offline files) to reduce time of this command : |
---|
[1012] | 1024 | #IGCM_sys_RshArchive "dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget -q -n" |
---|
[793] | 1025 | i=0 |
---|
| 1026 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 1027 | \rcp -rp ${STOREHOST}:$1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[793] | 1028 | status=$? |
---|
| 1029 | if [ ${status} -gt 0 ]; then |
---|
| 1030 | IGCM_debug_Print 2 "IGCM_sys_Get_Dir : rcp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
| 1031 | IGCM_debug_Print 2 "IGCM_sys_Get_Dir : sleep ${DELAI} seconds and try again." |
---|
| 1032 | sleep $DELAI |
---|
| 1033 | else |
---|
| 1034 | break |
---|
| 1035 | fi |
---|
| 1036 | (( i = i + 1 )) |
---|
| 1037 | done |
---|
| 1038 | else |
---|
[1179] | 1039 | \cp -rp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 1040 | status=$? |
---|
[793] | 1041 | if [ ${status} -gt 0 ] ; then |
---|
| 1042 | IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status}" |
---|
[1179] | 1043 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[793] | 1044 | IGCM_debug_Exit "IGCM_sys_Get_Dir" |
---|
[771] | 1045 | else |
---|
[1179] | 1046 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1047 | fi |
---|
[793] | 1048 | fi |
---|
[771] | 1049 | if [ ${status} -gt 0 ] ; then |
---|
[1179] | 1050 | IGCM_debug_Print 2 "IGCM_sys_Get_Dir : (r)cp failed error code ${status}" |
---|
| 1051 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1052 | IGCM_debug_Exit "IGCM_sys_Get_Dir" |
---|
| 1053 | else |
---|
[1179] | 1054 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1055 | fi |
---|
| 1056 | fi |
---|
| 1057 | IGCM_debug_PopStack "IGCM_sys_Get_Dir" |
---|
| 1058 | } |
---|
| 1059 | |
---|
| 1060 | #D-#================================================== |
---|
| 1061 | #D-function IGCM_sys_Get_Master |
---|
| 1062 | #D-* Purpose: Copy a complete directory from MASTER filesystem |
---|
| 1063 | #D-* Examples: |
---|
| 1064 | #D- |
---|
| 1065 | function IGCM_sys_Get_Master { |
---|
| 1066 | IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ |
---|
| 1067 | if ( $DEBUG_sys ) ; then |
---|
| 1068 | echo "IGCM_sys_Get_Master :" $@ |
---|
| 1069 | fi |
---|
| 1070 | if [ $DRYRUN = 0 ]; then |
---|
| 1071 | if ( [ ! -d ${1} ] && [ ! -f ${1} ] ) ; then |
---|
| 1072 | echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." |
---|
| 1073 | IGCM_debug_PopStack "IGCM_sys_Get_Master" |
---|
| 1074 | return |
---|
| 1075 | fi |
---|
| 1076 | |
---|
| 1077 | typeset NB_ESSAI DELAI status i |
---|
| 1078 | # number of tentative |
---|
| 1079 | NB_ESSAI=3 |
---|
| 1080 | # time delay between tentative |
---|
| 1081 | DELAI=2 |
---|
| 1082 | |
---|
| 1083 | i=0 |
---|
| 1084 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 1085 | \cp -urL $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 1086 | status=$? |
---|
| 1087 | if [ ${status} -gt 0 ]; then |
---|
| 1088 | IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
| 1089 | IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." |
---|
| 1090 | sleep $DELAI |
---|
| 1091 | else |
---|
| 1092 | break |
---|
| 1093 | fi |
---|
| 1094 | (( i = i + 1 )) |
---|
| 1095 | done |
---|
| 1096 | |
---|
| 1097 | if [ ${status} -gt 0 ] ; then |
---|
| 1098 | echo "IGCM_sys_Get_Master : error." |
---|
[1179] | 1099 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1100 | IGCM_debug_Exit "IGCM_sys_Get_Master" |
---|
| 1101 | else |
---|
[1179] | 1102 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1103 | fi |
---|
| 1104 | fi |
---|
| 1105 | IGCM_debug_PopStack "IGCM_sys_Get_Master" |
---|
| 1106 | } |
---|
| 1107 | |
---|
| 1108 | #==================================================== |
---|
| 1109 | #- Call IGCM_sys_Mirror_libIGCM now ! |
---|
| 1110 | if ( $MirrorlibIGCM ) ; then |
---|
| 1111 | IGCM_sys_Mirror_libIGCM |
---|
| 1112 | fi |
---|
| 1113 | |
---|
| 1114 | #D-#================================================== |
---|
| 1115 | #D-function IGCM_sys_Put_Rest |
---|
| 1116 | #D-* Purpose: Put computied restarts on ${ARCHIVE}. |
---|
| 1117 | #D- File and target directory must exist. |
---|
| 1118 | #D-* Examples: |
---|
| 1119 | #D- |
---|
| 1120 | function IGCM_sys_Put_Rest { |
---|
| 1121 | IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ |
---|
| 1122 | if ( $DEBUG_sys ) ; then |
---|
| 1123 | echo "IGCM_sys_Put_Rest :" $@ |
---|
| 1124 | fi |
---|
| 1125 | if [ $DRYRUN = 0 ]; then |
---|
| 1126 | if [ ! -f ${1} ] ; then |
---|
| 1127 | echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." |
---|
| 1128 | IGCM_debug_Exit "IGCM_sys_Put_Rest" |
---|
| 1129 | fi |
---|
| 1130 | |
---|
| 1131 | typeset status |
---|
| 1132 | # |
---|
| 1133 | if [ X${JobType} = XRUN ] ; then |
---|
| 1134 | IGCM_sys_Chmod 444 ${1} |
---|
| 1135 | fi |
---|
| 1136 | # |
---|
| 1137 | # |
---|
[792] | 1138 | #Command depends on targeted file system |
---|
[798] | 1139 | DEBUG_sys=false IGCM_sys_IsFileArchived $2 |
---|
[792] | 1140 | if [ $? = 0 ] ; then |
---|
[1179] | 1141 | mfput $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[792] | 1142 | status=$? |
---|
| 1143 | else |
---|
[795] | 1144 | IGCM_sys_MkdirArchive $( dirname $2 ) |
---|
[1179] | 1145 | \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[792] | 1146 | status=$? |
---|
| 1147 | fi |
---|
[771] | 1148 | |
---|
| 1149 | # #RSYNC WITH NETWORK RSH CALL |
---|
[795] | 1150 | # IGCM_sys_MkdirArchive $( dirname $2 ) |
---|
[1179] | 1151 | # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
| 1152 | # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 1153 | |
---|
| 1154 | # #RSYNC WITH NFS USE |
---|
[1179] | 1155 | # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
| 1156 | # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 1157 | |
---|
| 1158 | # status=$? |
---|
| 1159 | # IGCM_sys_Rsync_out $status |
---|
| 1160 | |
---|
[1179] | 1161 | # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1162 | # (( status=status+$? )) |
---|
| 1163 | |
---|
| 1164 | if [ ${status} -gt 0 ] ; then |
---|
[1179] | 1165 | IGCM_debug_Print 2 "IGCM_sys_Put_Rest : mfput or cp failed error code ${status}" |
---|
| 1166 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1167 | IGCM_debug_Exit "IGCM_sys_Put_Rest" |
---|
| 1168 | else |
---|
[1179] | 1169 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1170 | fi |
---|
| 1171 | fi |
---|
| 1172 | IGCM_debug_PopStack "IGCM_sys_Put_Rest" |
---|
| 1173 | } |
---|
| 1174 | |
---|
| 1175 | #D-#================================================== |
---|
| 1176 | #D-function IGCM_sys_PutBuffer_Rest |
---|
| 1177 | #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. |
---|
| 1178 | #D- File and target directory must exist. |
---|
| 1179 | #D-* Examples: |
---|
| 1180 | #D- |
---|
| 1181 | function IGCM_sys_PutBuffer_Rest { |
---|
| 1182 | IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ |
---|
| 1183 | if ( $DEBUG_sys ) ; then |
---|
| 1184 | echo "IGCM_sys_PutBuffer_Rest :" $@ |
---|
| 1185 | fi |
---|
| 1186 | if [ $DRYRUN = 0 ]; then |
---|
| 1187 | if [ ! -f ${1} ] ; then |
---|
| 1188 | echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." |
---|
| 1189 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" |
---|
| 1190 | fi |
---|
| 1191 | |
---|
| 1192 | typeset status |
---|
| 1193 | # |
---|
| 1194 | # USUAL WAY |
---|
[1179] | 1195 | \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 1196 | status=$? |
---|
| 1197 | |
---|
| 1198 | if [ ${status} -gt 0 ] ; then |
---|
| 1199 | echo "IGCM_sys_PutBuffer_Rest : error code ${status}" |
---|
| 1200 | [ -f ${2} ] && ls -l ${2} |
---|
| 1201 | [ -f ${2}/${1} ] && ls -l ${2}/${1} |
---|
[1179] | 1202 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1203 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" |
---|
| 1204 | else |
---|
[1179] | 1205 | |
---|
| 1206 | if [ X${JobType} = XRUN ] ; then |
---|
| 1207 | [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} |
---|
| 1208 | [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} |
---|
| 1209 | fi |
---|
| 1210 | |
---|
| 1211 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1212 | fi |
---|
| 1213 | fi |
---|
| 1214 | IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest" |
---|
| 1215 | } |
---|
| 1216 | |
---|
| 1217 | #D-#================================================== |
---|
[801] | 1218 | #D-function IGCM_sys_PrepareTaredRestart |
---|
| 1219 | #D-* Purpose: Prepare tared restart to be access by computing job. |
---|
| 1220 | #D-* Examples: |
---|
| 1221 | #D- |
---|
| 1222 | function IGCM_sys_PrepareTaredRestart { |
---|
| 1223 | IGCM_debug_PushStack "IGCM_sys_PrepareTaredRestart" $@ |
---|
| 1224 | if [ $DRYRUN = 0 ]; then |
---|
[918] | 1225 | [ ! -f $( basename $1 ) ] && IGCM_sys_Get $1 . |
---|
[801] | 1226 | fi |
---|
| 1227 | IGCM_debug_PopStack "IGCM_sys_PrepareTaredRestart" |
---|
| 1228 | } |
---|
| 1229 | |
---|
| 1230 | #D-#================================================== |
---|
[771] | 1231 | #D-function IGCM_sys_Put_Out |
---|
| 1232 | #D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly |
---|
| 1233 | #D-* Examples: |
---|
| 1234 | #D- |
---|
| 1235 | function IGCM_sys_Put_Out { |
---|
| 1236 | IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ |
---|
| 1237 | if ( $DEBUG_sys ) ; then |
---|
| 1238 | echo "IGCM_sys_Put_Out :" $@ |
---|
| 1239 | fi |
---|
| 1240 | |
---|
| 1241 | typeset status |
---|
| 1242 | |
---|
| 1243 | if [ $DRYRUN = 0 ]; then |
---|
| 1244 | if [ ! -f ${1} ] ; then |
---|
| 1245 | echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." |
---|
| 1246 | IGCM_debug_PopStack "IGCM_sys_Put_Out" |
---|
| 1247 | return 1 |
---|
| 1248 | fi |
---|
| 1249 | # |
---|
| 1250 | if [ X${JobType} = XRUN ] ; then |
---|
| 1251 | if [ X${3} = X ] ; then |
---|
| 1252 | IGCM_sys_Chmod 444 ${1} |
---|
| 1253 | fi |
---|
| 1254 | fi |
---|
| 1255 | # |
---|
| 1256 | # |
---|
[792] | 1257 | #Command depends on targeted file system |
---|
[798] | 1258 | DEBUG_sys=false IGCM_sys_IsFileArchived $2 |
---|
[792] | 1259 | if [ $? = 0 ] ; then |
---|
[1179] | 1260 | mfput $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[792] | 1261 | status=$? |
---|
| 1262 | else |
---|
[795] | 1263 | IGCM_sys_MkdirArchive $( dirname $2 ) |
---|
[1179] | 1264 | \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[792] | 1265 | status=$? |
---|
| 1266 | fi |
---|
[771] | 1267 | |
---|
| 1268 | # #RSYNC WITH NETWORK RSH CALL |
---|
[795] | 1269 | # IGCM_sys_MkdirArchive $( dirname $2 ) |
---|
[1179] | 1270 | # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
| 1271 | # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 1272 | |
---|
| 1273 | # #RSYNC WITH NFS USE |
---|
[1179] | 1274 | # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
| 1275 | # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 1276 | |
---|
| 1277 | # status=$? |
---|
| 1278 | # IGCM_sys_Rsync_out $status |
---|
| 1279 | |
---|
[1179] | 1280 | # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1281 | # (( status=status+$? )) |
---|
| 1282 | |
---|
| 1283 | if [ ${status} -gt 0 ] ; then |
---|
[792] | 1284 | IGCM_debug_Print 2 "IGCM_sys_Put_Out : mfput or cp failed error code ${status}" |
---|
[1179] | 1285 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1286 | IGCM_debug_Exit "IGCM_sys_Put_Out" |
---|
| 1287 | else |
---|
[1179] | 1288 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1289 | fi |
---|
| 1290 | fi |
---|
| 1291 | IGCM_debug_PopStack "IGCM_sys_Put_Out" |
---|
| 1292 | return 0 |
---|
| 1293 | } |
---|
| 1294 | |
---|
| 1295 | #D-#================================================== |
---|
| 1296 | #D-function IGCM_sys_PutBuffer_Out |
---|
| 1297 | #D-* Purpose: Copy a file on ${WORKDIR} after having chmod it in readonly |
---|
| 1298 | #D-* Examples: |
---|
| 1299 | #D- |
---|
| 1300 | function IGCM_sys_PutBuffer_Out { |
---|
| 1301 | IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@ |
---|
| 1302 | if ( $DEBUG_sys ) ; then |
---|
| 1303 | echo "IGCM_sys_PutBuffer_Out :" $@ |
---|
| 1304 | fi |
---|
| 1305 | |
---|
| 1306 | typeset NB_ESSAI DELAI status i exist skip |
---|
| 1307 | |
---|
| 1308 | # number of tentative |
---|
| 1309 | NB_ESSAI=3 |
---|
| 1310 | # time delay between tentative |
---|
| 1311 | DELAI=2 |
---|
| 1312 | |
---|
| 1313 | if [ $DRYRUN = 0 ]; then |
---|
| 1314 | if [ ! -f ${1} ] ; then |
---|
| 1315 | echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ." |
---|
| 1316 | IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" |
---|
| 1317 | return 1 |
---|
| 1318 | fi |
---|
| 1319 | # |
---|
| 1320 | IGCM_sys_Mkdir $( dirname $2 ) |
---|
| 1321 | # |
---|
| 1322 | |
---|
| 1323 | exist=false |
---|
| 1324 | skip=false |
---|
| 1325 | if [ -f $2 ] ; then |
---|
| 1326 | IGCM_debug_Print 1 "$2 already exist" |
---|
| 1327 | exist=true |
---|
| 1328 | if [ "X$( diff $1 $2 )" = X ] ; then |
---|
| 1329 | IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" |
---|
[788] | 1330 | status=0 |
---|
[771] | 1331 | skip=true |
---|
| 1332 | else |
---|
| 1333 | IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" |
---|
| 1334 | skip=false |
---|
| 1335 | fi |
---|
| 1336 | fi |
---|
| 1337 | # |
---|
| 1338 | if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then |
---|
| 1339 | IGCM_sys_Chmod u+w $2 |
---|
| 1340 | fi |
---|
| 1341 | |
---|
| 1342 | if [ X${skip} = Xfalse ] ; then |
---|
| 1343 | i=0 |
---|
| 1344 | while [ $i -lt $NB_ESSAI ] ; do |
---|
| 1345 | # USUAL WAY |
---|
[1179] | 1346 | \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 1347 | status=$? |
---|
| 1348 | if [ ${status} -gt 0 ]; then |
---|
| 1349 | IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
| 1350 | IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again." |
---|
| 1351 | [ -f ${2} ] && ls -l ${2} |
---|
| 1352 | [ -f ${2}/${1} ] && ls -l ${2}/${1} |
---|
| 1353 | sleep $DELAI |
---|
| 1354 | else |
---|
| 1355 | break |
---|
| 1356 | fi |
---|
| 1357 | (( i = i + 1 )) |
---|
| 1358 | done |
---|
| 1359 | fi |
---|
| 1360 | |
---|
| 1361 | if [ ${status} -gt 0 ] ; then |
---|
| 1362 | echo "IGCM_sys_PutBuffer_Out : error." |
---|
| 1363 | [ -f ${2} ] && ls -l ${2} |
---|
| 1364 | [ -f ${2}/${1} ] && ls -l ${2}/${1} |
---|
[1179] | 1365 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1366 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" |
---|
| 1367 | else |
---|
| 1368 | |
---|
| 1369 | if [ X${JobType} = XRUN ] ; then |
---|
| 1370 | if [ X${3} = X ] ; then |
---|
| 1371 | [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} |
---|
| 1372 | [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} |
---|
| 1373 | fi |
---|
| 1374 | fi |
---|
| 1375 | |
---|
[1179] | 1376 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1377 | fi |
---|
| 1378 | fi |
---|
| 1379 | IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" |
---|
| 1380 | return 0 |
---|
| 1381 | } |
---|
| 1382 | |
---|
| 1383 | #D-#================================================== |
---|
| 1384 | #D-function IGCM_sys_Get |
---|
| 1385 | #D-* Purpose: Get a file from ${ARCHIVE} |
---|
| 1386 | #D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX |
---|
| 1387 | #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ |
---|
| 1388 | function IGCM_sys_Get { |
---|
| 1389 | IGCM_debug_PushStack "IGCM_sys_Get" $@ |
---|
| 1390 | |
---|
| 1391 | typeset DEST status dm_liste |
---|
| 1392 | |
---|
| 1393 | if ( $DEBUG_sys ) ; then |
---|
| 1394 | echo "IGCM_sys_Get :" $@ |
---|
| 1395 | fi |
---|
| 1396 | if [ $DRYRUN -le 2 ]; then |
---|
| 1397 | if [ X${1} = X'/l' ] ; then |
---|
| 1398 | eval set +A dm_liste \${${2}} |
---|
| 1399 | else |
---|
| 1400 | dm_liste=${1} |
---|
| 1401 | fi |
---|
| 1402 | eval DEST=\${${#}} |
---|
| 1403 | |
---|
| 1404 | # test if the (first) file is present in the old computation : |
---|
[798] | 1405 | DEBUG_sys=false IGCM_sys_IsFileArchived ${dm_liste[0]} |
---|
[796] | 1406 | if [ $? = 0 ] ; then |
---|
| 1407 | IGCM_sys_TestFileArchive ${dm_liste[0]} |
---|
| 1408 | status=$? |
---|
| 1409 | else |
---|
[798] | 1410 | IGCM_sys_TestFileBuffer ${dm_liste[0]} |
---|
[796] | 1411 | status=$? |
---|
| 1412 | fi |
---|
| 1413 | |
---|
[771] | 1414 | if [ ${status} -gt 0 ] ; then |
---|
| 1415 | echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." |
---|
| 1416 | IGCM_debug_Exit "IGCM_sys_Get" |
---|
| 1417 | return |
---|
| 1418 | fi |
---|
| 1419 | |
---|
[792] | 1420 | #Command depends on targeted file system |
---|
[798] | 1421 | DEBUG_sys=false IGCM_sys_IsFileArchived ${dm_liste[0]} |
---|
[792] | 1422 | if [ $? = 0 ] ; then |
---|
[1179] | 1423 | mfget ${dm_liste[*]} ${DEST} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[792] | 1424 | status=$? |
---|
| 1425 | else |
---|
[1179] | 1426 | \cp ${dm_liste[*]} ${DEST} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[792] | 1427 | status=$? |
---|
| 1428 | fi |
---|
[771] | 1429 | |
---|
| 1430 | # #RSYNC WITH NETWORK RSH CALL |
---|
[1179] | 1431 | # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
| 1432 | # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 1433 | |
---|
| 1434 | # #RSYNC WITH NFS USE |
---|
[1179] | 1435 | # echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
| 1436 | # ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 1437 | |
---|
| 1438 | # status=$? |
---|
| 1439 | # IGCM_sys_Rsync_out $status |
---|
| 1440 | |
---|
[1179] | 1441 | # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1442 | # (( status=status+$? )) |
---|
| 1443 | |
---|
| 1444 | if [ ${status} -gt 0 ] ; then |
---|
[792] | 1445 | IGCM_debug_Print 2 "IGCM_sys_Get : mfget or cp failed error code ${status}" |
---|
[1179] | 1446 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1447 | IGCM_debug_Exit "IGCM_sys_Get" |
---|
| 1448 | else |
---|
[1179] | 1449 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1450 | fi |
---|
| 1451 | fi |
---|
| 1452 | IGCM_debug_PopStack "IGCM_sys_Get" |
---|
| 1453 | } |
---|
| 1454 | |
---|
| 1455 | #D-#================================================== |
---|
| 1456 | #D-function IGCM_sys_GetBuffer |
---|
| 1457 | #D-* Purpose: Get a file from ${SCRATCHDIR} |
---|
| 1458 | #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX |
---|
| 1459 | #D- IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ |
---|
| 1460 | function IGCM_sys_GetBuffer { |
---|
| 1461 | IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ |
---|
| 1462 | |
---|
| 1463 | typeset DEST buf_liste target file_work |
---|
| 1464 | typeset NB_ESSAI DELAI status i |
---|
| 1465 | |
---|
| 1466 | if ( $DEBUG_sys ) ; then |
---|
| 1467 | echo "IGCM_sys_GetBuffer :" $@ |
---|
| 1468 | fi |
---|
| 1469 | |
---|
| 1470 | # number of tentative |
---|
| 1471 | NB_ESSAI=3 |
---|
| 1472 | # time delay between tentative |
---|
| 1473 | DELAI=2 |
---|
| 1474 | |
---|
| 1475 | if [ $DRYRUN -le 2 ]; then |
---|
| 1476 | if [ X${1} = X'/l' ] ; then |
---|
| 1477 | eval set +A buf_liste \${${2}} |
---|
| 1478 | else |
---|
| 1479 | eval set +A buf_liste ${1} |
---|
| 1480 | fi |
---|
| 1481 | eval DEST=\${${#}} |
---|
| 1482 | |
---|
| 1483 | #USUAL WAY |
---|
| 1484 | if [ X${1} = X'/l' ] ; then |
---|
| 1485 | for target in ${buf_liste[*]} ; do |
---|
| 1486 | local_file=$( basename ${target} ) |
---|
| 1487 | i=0 |
---|
| 1488 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 1489 | \cp ${target} ${DEST}/${local_file} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 1490 | status=$? |
---|
| 1491 | if [ ${status} -gt 0 ]; then |
---|
| 1492 | IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
| 1493 | IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." |
---|
| 1494 | sleep $DELAI |
---|
| 1495 | else |
---|
| 1496 | break |
---|
| 1497 | fi |
---|
| 1498 | (( i = i + 1 )) |
---|
| 1499 | done |
---|
| 1500 | if [ ${status} -gt 0 ] ; then |
---|
| 1501 | echo "IGCM_sys_Get : error" |
---|
[1179] | 1502 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 1503 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1504 | IGCM_debug_Exit "IGCM_sys_GetBuffer" |
---|
| 1505 | else |
---|
[1179] | 1506 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1507 | fi |
---|
| 1508 | done |
---|
| 1509 | else |
---|
| 1510 | i=0 |
---|
| 1511 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 1512 | \cp ${buf_liste} ${DEST} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 1513 | status=$? |
---|
| 1514 | if [ ${status} -gt 0 ]; then |
---|
| 1515 | IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
| 1516 | IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." |
---|
| 1517 | sleep $DELAI |
---|
| 1518 | else |
---|
| 1519 | break |
---|
| 1520 | fi |
---|
| 1521 | (( i = i + 1 )) |
---|
| 1522 | done |
---|
| 1523 | if [ ${status} -gt 0 ] ; then |
---|
| 1524 | echo "IGCM_sys_Get : error" |
---|
[1179] | 1525 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 1526 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1527 | IGCM_debug_Exit "IGCM_sys_GetBuffer" |
---|
| 1528 | else |
---|
[1179] | 1529 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1530 | fi |
---|
| 1531 | fi |
---|
| 1532 | fi |
---|
| 1533 | IGCM_debug_PopStack "IGCM_sys_GetBuffer" |
---|
| 1534 | } |
---|
| 1535 | |
---|
| 1536 | #D-#================================================== |
---|
| 1537 | #D-function IGCM_sys_GetDate_FichWork |
---|
| 1538 | #D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK |
---|
| 1539 | #D-* Examples: |
---|
| 1540 | #D- |
---|
| 1541 | function IGCM_sys_GetDate_FichWork { |
---|
| 1542 | IGCM_debug_PushStack "IGCM_sys_FichWork" $@ |
---|
| 1543 | if ( $DEBUG_sys ) ; then |
---|
| 1544 | echo "IGCM_sys_GetDate_FichWork :" $@ |
---|
| 1545 | fi |
---|
[955] | 1546 | |
---|
| 1547 | if [ $# -ge 3 ] ; then |
---|
| 1548 | mode=$3 |
---|
| 1549 | TimeStyle=$4 |
---|
| 1550 | else |
---|
| 1551 | mode="default" |
---|
| 1552 | TimeStyle="%Y%m%d%H%M%S" |
---|
| 1553 | fi |
---|
| 1554 | |
---|
[771] | 1555 | typeset dateF |
---|
[955] | 1556 | set +A dateF -- $( ls -l --full-time --time-style=+"${TimeStyle}" ${1} ) |
---|
[771] | 1557 | |
---|
[955] | 1558 | case $mode in |
---|
| 1559 | "default") |
---|
| 1560 | eval ${2}=${dateF[5]} |
---|
| 1561 | ;; |
---|
| 1562 | "SplitFields") |
---|
| 1563 | eval ${2}="${dateF[5]}\ ${dateF[6]}" |
---|
| 1564 | ;; |
---|
| 1565 | esac |
---|
| 1566 | |
---|
| 1567 | |
---|
[771] | 1568 | # donne la date filesys d'un fichier sur la machine work |
---|
| 1569 | IGCM_debug_PopStack "IGCM_sys_FichWork" |
---|
| 1570 | } |
---|
| 1571 | |
---|
| 1572 | #D-#================================================== |
---|
| 1573 | #D-function IGCM_sys_GetDate_FichArchive |
---|
| 1574 | #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE |
---|
| 1575 | #D-* Examples: |
---|
| 1576 | #D- |
---|
| 1577 | function IGCM_sys_GetDate_FichArchive { |
---|
| 1578 | IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ |
---|
| 1579 | if ( $DEBUG_sys ) ; then |
---|
| 1580 | echo "IGCM_sys_GetDate_FichArchive :" $@ |
---|
| 1581 | fi |
---|
| 1582 | typeset dateF |
---|
| 1583 | set +A dateF -- $( rsh ${STOREHOST} -n ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) |
---|
| 1584 | eval ${2}=${dateF[5]} |
---|
| 1585 | |
---|
| 1586 | IGCM_debug_PopStack "IGCM_sys_FichArchive" |
---|
| 1587 | } |
---|
| 1588 | |
---|
| 1589 | #D-#================================================== |
---|
[835] | 1590 | #D-function IGCM_sys_GetDate_Monitoring |
---|
| 1591 | #D-* Purpose: get the last year for which the monitoring has been computed |
---|
| 1592 | #D-* Examples: |
---|
| 1593 | #D- |
---|
| 1594 | function IGCM_sys_GetDate_Monitoring { |
---|
| 1595 | IGCM_debug_PushStack "IGCM_sys_GetDate_Monitoring" $@ |
---|
| 1596 | if ( $DEBUG_sys ) ; then |
---|
| 1597 | echo "IGCM_sys_GetDate_Monitoring :" $@ |
---|
| 1598 | fi |
---|
| 1599 | |
---|
| 1600 | IGCM_sys_Cd /tmp |
---|
[1129] | 1601 | # NASTY HACK. We force /tmp here. This function is called only from the front-end and interactively. |
---|
| 1602 | RUN_DIR_PATH=/tmp IGCM_sys_Get ${1} . |
---|
[835] | 1603 | eval ${2}=$( cdo showyear $( basename ${1} ) 2> /dev/null | gawk '{ print $NF }' ) |
---|
[1131] | 1604 | # Need to erase this file to avoid collision (permission denied getting file) between users on the front-end |
---|
| 1605 | IGCM_sys_Rm -f $( basename ${1} ) |
---|
[835] | 1606 | IGCM_sys_Cd - |
---|
| 1607 | |
---|
| 1608 | IGCM_debug_PopStack "IGCM_sys_GetDate_Monitoring" |
---|
| 1609 | } |
---|
| 1610 | |
---|
| 1611 | #D-#================================================== |
---|
[771] | 1612 | #D-function IGCM_sys_Put_Dods |
---|
[1179] | 1613 | #D-* Purpose: Put ${ARCHIVE} files on DODS internet protocole. |
---|
[771] | 1614 | #D-* Examples: |
---|
| 1615 | #D- |
---|
| 1616 | function IGCM_sys_Put_Dods { |
---|
| 1617 | IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@ |
---|
| 1618 | if ( $DEBUG_sys ) ; then |
---|
| 1619 | echo "IGCM_sys_Put_Dods :" $@ |
---|
| 1620 | fi |
---|
[1179] | 1621 | typeset status |
---|
[771] | 1622 | if [ $DRYRUN = 0 ]; then |
---|
| 1623 | # We take our time on that |
---|
| 1624 | sleep 10 |
---|
| 1625 | IGCM_sys_TestDirArchive ${R_SAVE}/${1} |
---|
| 1626 | if [ $? != 0 ] ; then |
---|
| 1627 | echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ." |
---|
| 1628 | IGCM_debug_PopStack "IGCM_sys_Put_Dods" |
---|
| 1629 | return |
---|
| 1630 | fi |
---|
| 1631 | |
---|
[1012] | 1632 | rsh ${STOREHOST} exec /bin/ksh <<EOF |
---|
[771] | 1633 | cd ${R_SAVE} |
---|
[1012] | 1634 | /arch/local/bin/dods_rm DODS/pub/${LOGIN}/${R_DODS}/${1} > /dev/null 2>&1 |
---|
[771] | 1635 | /bin/chmod -R u+w ${R_SAVE}/${1} |
---|
[1012] | 1636 | /arch/local/bin/dods_cp ${1} DODS/pub/${LOGIN}/${R_DODS} > /dev/null 2>&1 |
---|
[771] | 1637 | /bin/chmod -R +rX ${R_SAVE}/${1} |
---|
| 1638 | /bin/chmod -R u+w ${R_SAVE}/${1} |
---|
| 1639 | EOF |
---|
| 1640 | status=$? |
---|
| 1641 | |
---|
| 1642 | if [ ${status} -gt 0 ] ; then |
---|
| 1643 | echo "IGCM_sys_Put_Dods : error." |
---|
| 1644 | IGCM_debug_Exit "IGCM_sys_Put_Dods" |
---|
| 1645 | fi |
---|
| 1646 | fi |
---|
| 1647 | IGCM_debug_PopStack "IGCM_sys_Put_Dods" |
---|
| 1648 | } |
---|
| 1649 | |
---|
| 1650 | ############################################################## |
---|
| 1651 | # REBUILD OPERATOR |
---|
| 1652 | |
---|
[811] | 1653 | #D-#================================================== |
---|
[1163] | 1654 | #D-function IGCM_sys_sync |
---|
| 1655 | #D-* Purpose: flush buffer on disk (dummy function on Ada) |
---|
| 1656 | #D-* Examples: |
---|
| 1657 | #D- |
---|
| 1658 | function IGCM_sys_sync { |
---|
| 1659 | IGCM_debug_PushStack "IGCM_sys_sync" $@ |
---|
| 1660 | if ( $DEBUG_sys ) ; then |
---|
| 1661 | echo "IGCM_sys_sync :" $@ |
---|
| 1662 | echo "Dummy call, let the system do that." |
---|
| 1663 | fi |
---|
| 1664 | IGCM_debug_PopStack "IGCM_sys_sync" |
---|
| 1665 | } |
---|
| 1666 | |
---|
| 1667 | #D-#================================================== |
---|
[811] | 1668 | #D-function IGCM_sys_rebuild |
---|
| 1669 | #D-* Purpose: rebuild parallel files |
---|
| 1670 | #D-* Examples: |
---|
| 1671 | #D- |
---|
[771] | 1672 | function IGCM_sys_rebuild { |
---|
[1057] | 1673 | IGCM_debug_PushStack "IGCM_sys_rebuild" $@ |
---|
[771] | 1674 | if ( $DEBUG_sys ) ; then |
---|
| 1675 | echo "IGCM_sys_rebuild :" $@ |
---|
| 1676 | fi |
---|
| 1677 | |
---|
| 1678 | typeset NB_ESSAI DELAI status i firstArg |
---|
| 1679 | # number of tentative |
---|
| 1680 | NB_ESSAI=3 |
---|
| 1681 | # time delay between tentative |
---|
| 1682 | DELAI=2 |
---|
| 1683 | |
---|
| 1684 | i=0 |
---|
| 1685 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 1686 | rebuild -f -o $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 1687 | status=$? |
---|
| 1688 | if [ ${status} -gt 0 ] ; then |
---|
| 1689 | IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" |
---|
[1179] | 1690 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 1691 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1692 | IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 1693 | firstArg=${1} |
---|
| 1694 | \rm ${firstArg} |
---|
| 1695 | sleep $DELAI |
---|
| 1696 | else |
---|
[1179] | 1697 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 1698 | break |
---|
| 1699 | fi |
---|
| 1700 | (( i = i + 1 )) |
---|
| 1701 | done |
---|
| 1702 | |
---|
| 1703 | if [ ${status} -gt 0 ] ; then |
---|
| 1704 | echo "IGCM_sys_rebuild : rebuild error code is ${status}" |
---|
| 1705 | IGCM_debug_Exit "rebuild" |
---|
| 1706 | fi |
---|
| 1707 | |
---|
| 1708 | IGCM_debug_PopStack "IGCM_sys_rebuild" |
---|
| 1709 | } |
---|
| 1710 | |
---|
[811] | 1711 | #D-#================================================== |
---|
| 1712 | #D-function IGCM_sys_rebuild_station |
---|
[922] | 1713 | #D-* Purpose: rebuild parallel files describing station |
---|
[811] | 1714 | #D-* Examples: |
---|
| 1715 | #D- |
---|
[771] | 1716 | function IGCM_sys_rebuild_station { |
---|
[1057] | 1717 | IGCM_debug_PushStack "IGCM_sys_rebuild_station" $@ |
---|
[771] | 1718 | typeset i list_opt file_in file_out prefix_invert list_invert |
---|
| 1719 | if ( $DEBUG_sys ) ; then |
---|
| 1720 | echo "IGCM_sys_rebuild_station :" $@ |
---|
| 1721 | fi |
---|
| 1722 | list_opt=$@ |
---|
| 1723 | |
---|
| 1724 | # Invert Axis : t,x -> x,t |
---|
| 1725 | # t,pres,x -> x,t,pres |
---|
| 1726 | # So that we can concatenate along x |
---|
| 1727 | i=0 |
---|
| 1728 | for file_in in ${list_opt} ; do |
---|
| 1729 | (( i = i + 1)) |
---|
| 1730 | [ ${i} = 1 ] && file_out=${file_in} && continue |
---|
[1046] | 1731 | # detect time counter and do the job only if present |
---|
[1147] | 1732 | var_unlim=$(ncdump -h ${file_in} | grep UNLIMITED | cut -d ' ' -f 1 | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') |
---|
[1046] | 1733 | if [ X${var_unlim} = Xtime_counter ] ; then |
---|
| 1734 | prefix_invert=$( basename ${file_in} .nc ) |
---|
| 1735 | IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs ${file_in} ${prefix_invert}_xt.nc |
---|
| 1736 | list_invert[${#list_invert[*]}]=${prefix_invert}_xt.nc |
---|
| 1737 | fi |
---|
[771] | 1738 | done |
---|
| 1739 | |
---|
| 1740 | # Concatenate |
---|
| 1741 | IGCM_sys_ncrcat ${list_invert[*]} histstn_xt.nc |
---|
| 1742 | |
---|
| 1743 | # Re-ivert file |
---|
| 1744 | IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x histstn_xt.nc ${file_out} |
---|
| 1745 | |
---|
[922] | 1746 | # Station re-ordering is too expansive to be run within libIGCM |
---|
[771] | 1747 | # This is due to (ncpdq - nrcat - ncpdq) I/O sequence. |
---|
| 1748 | # This re-ordering must be done "in memory" by the cmorization process |
---|
| 1749 | # Anyway this is the best sequence using (ncpdq - nrcat - ncpdq) |
---|
| 1750 | # BEGIN reordering |
---|
| 1751 | |
---|
| 1752 | # Only LMDZ text output contains the exact ordering of the station. |
---|
| 1753 | # We isolate this in the code below: |
---|
| 1754 | # 0 38 -157.5000000000000 70.98591549295774 |
---|
| 1755 | # 0 54 27.49999999999999 67.18309859154928 |
---|
| 1756 | # 0 56 -62.50000000000001 82.39436619718309 |
---|
| 1757 | # 0 79 12.49999999999999 78.59154929577466 |
---|
| 1758 | # 0 116 -165.0000000000000 76.05633802816901 |
---|
| 1759 | # 0 117 130.0000000000000 70.98591549295774 |
---|
| 1760 | # 0 118 110.0000000000000 87.46478873239437 |
---|
| 1761 | # 1 40 4.999999999999995 51.97183098591550 |
---|
[1179] | 1762 | |
---|
[771] | 1763 | # typeset iStation iProc list_opt file_in file_out prefix_invert |
---|
| 1764 | # typeset -Z4 j4 |
---|
| 1765 | # typeset -Z3 j3 |
---|
| 1766 | |
---|
| 1767 | # unset list_opt |
---|
| 1768 | # set +A list_opt $@ |
---|
| 1769 | |
---|
| 1770 | # Filename after rebuild |
---|
| 1771 | # file_out=${list_opt[0]} |
---|
| 1772 | # Prefix of output files |
---|
| 1773 | # prefix_invert=$( basename ${file_out} .nc ) |
---|
| 1774 | # Number of procs |
---|
| 1775 | # num_proc=$( grep -i mpi_size ${PREFIX}_${Exe_Output} | wc -l ) |
---|
| 1776 | |
---|
| 1777 | # iProc=0 |
---|
| 1778 | # while [ ${iProc} -lt ${num_proc} ] ; do |
---|
| 1779 | # Array containing Station as a number |
---|
| 1780 | # unset proc_stn |
---|
[944] | 1781 | # set +A proc_stn $( grep "iophy_mpi rank ip lon lat $iProc" ${PREFIX}_${Exe_Output} | sed -e "s/iophy_mpi rank ip lon lat //g" | gawk ' {print $2}' ) |
---|
[771] | 1782 | # Number of stations produced by processor proc |
---|
| 1783 | # stationLast=${#proc_stn[*]} |
---|
| 1784 | # Proc number on 4 digits |
---|
| 1785 | # j4=${iProc} |
---|
| 1786 | # Init |
---|
| 1787 | # iStation=0 |
---|
| 1788 | # while [ ${iStation} -lt ${stationLast} ] ; do |
---|
| 1789 | # Station number on 3 digits |
---|
| 1790 | # j3=${proc_stn[${iStation}]} |
---|
| 1791 | # Extract station |
---|
| 1792 | # Invert Axis : t,x -> x,t |
---|
| 1793 | # t,pres,x -> x,t,pres |
---|
| 1794 | # So that we can concatenate along x |
---|
| 1795 | # IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs -d x,$iStation,$iStation ${prefix_invert}_${j4}.nc ${prefix_invert}_stn_${j3}.nc |
---|
| 1796 | # (( iStation = iStation + 1 )) |
---|
| 1797 | # done |
---|
| 1798 | # (( iProc = iProc + 1 )) |
---|
| 1799 | # done |
---|
| 1800 | |
---|
| 1801 | # Concatenate all station along x |
---|
| 1802 | # IGCM_sys_ncrcat ${prefix_invert}_stn_???.nc ${prefix_invert}_xt.nc |
---|
| 1803 | |
---|
| 1804 | # Re-invert file |
---|
| 1805 | # IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x ${prefix_invert}_xt.nc ${file_out} |
---|
| 1806 | |
---|
| 1807 | # END reordering |
---|
| 1808 | |
---|
| 1809 | IGCM_debug_PopStack "IGCM_sys_rebuild_station" |
---|
| 1810 | } |
---|
| 1811 | |
---|
| 1812 | ############################################################ |
---|
| 1813 | # Activate Running Environnment Variables |
---|
| 1814 | |
---|
[811] | 1815 | #D-#================================================== |
---|
| 1816 | #D-function IGCM_sys_desactiv_variables |
---|
| 1817 | #D-* Purpose: set environement variables prior to execution |
---|
| 1818 | #D-* Examples: |
---|
| 1819 | #D- |
---|
[771] | 1820 | function IGCM_sys_activ_variables { |
---|
| 1821 | IGCM_debug_PushStack "IGCM_sys_activ_variables" |
---|
| 1822 | if ( $DEBUG_sys ) ; then |
---|
[811] | 1823 | echo "IGCM_sys_activ_variables" |
---|
[771] | 1824 | fi |
---|
| 1825 | |
---|
[811] | 1826 | # -------------------------------------------------------------------- |
---|
| 1827 | #D- MPI specifications |
---|
| 1828 | # -------------------------------------------------------------------- |
---|
| 1829 | |
---|
| 1830 | # -------------------------------------------------------------------- |
---|
| 1831 | #D- Other specifications |
---|
| 1832 | # -------------------------------------------------------------------- |
---|
| 1833 | |
---|
[771] | 1834 | ulimit -s unlimited |
---|
[1012] | 1835 | ## to be done only one time |
---|
| 1836 | ## export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/smplocal/pub/NetCDF/4.1.3/lib:/smplocal/pub/HDF5/1.8.9/seq/lib |
---|
[1068] | 1837 | ## echo ${LD_LIBRARY_PATH} | grep -i netcdf >/dev/null 2>&1 || export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/smplocal/pub/NetCDF/4.1.3/lib:/smplocal/pub/HDF5/1.8.9/seq/lib |
---|
[1012] | 1838 | IGCM_debug_Print 1 "set LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" |
---|
[771] | 1839 | |
---|
[959] | 1840 | export MP_STDOUTMODE=combined |
---|
| 1841 | IGCM_debug_Print 1 "set MP_STDOUTMODE=${MP_STDOUTMODE}" |
---|
| 1842 | |
---|
[1004] | 1843 | ## fix to reduce memory usage. Required since 2014/22/04. On ada IDRIS. |
---|
| 1844 | export MP_EUILIBPATH=/smplocal/lib/ibmhpc/pe12012/ppe.pami/gnu/lib64/pami64 |
---|
| 1845 | IGCM_debug_Print 1 "set MP_EUILIBPATH=${MP_EUILIBPATH}" |
---|
| 1846 | |
---|
[771] | 1847 | IGCM_debug_PopStack "IGCM_sys_activ_variables" |
---|
| 1848 | } |
---|
| 1849 | |
---|
| 1850 | ############################################################ |
---|
| 1851 | # Desactivate Running Environnment Variables |
---|
| 1852 | |
---|
[811] | 1853 | #D-#================================================== |
---|
| 1854 | #D-function IGCM_sys_desactiv_variables |
---|
| 1855 | #D-* Purpose: unset environement variables after execution |
---|
| 1856 | #D-* Examples: |
---|
| 1857 | #D- |
---|
[771] | 1858 | function IGCM_sys_desactiv_variables { |
---|
| 1859 | IGCM_debug_PushStack "IGCM_sys_desactiv_variables" |
---|
| 1860 | if ( $DEBUG_sys ) ; then |
---|
[811] | 1861 | echo "IGCM_sys_desactiv_variables" |
---|
[771] | 1862 | fi |
---|
| 1863 | # -------------------------------------------------------------------- |
---|
| 1864 | #D- MPI specifications |
---|
| 1865 | # -------------------------------------------------------------------- |
---|
| 1866 | |
---|
| 1867 | # -------------------------------------------------------------------- |
---|
| 1868 | #D- Other specifications |
---|
| 1869 | # -------------------------------------------------------------------- |
---|
| 1870 | |
---|
| 1871 | IGCM_debug_PopStack "IGCM_sys_desactiv_variables" |
---|
| 1872 | } |
---|
| 1873 | |
---|
| 1874 | ############################################################ |
---|
| 1875 | # Build MPI/OMP scripts run file (dummy function) |
---|
| 1876 | |
---|
[811] | 1877 | #D-#================================================== |
---|
| 1878 | #D-function IGCM_sys_build_run_file |
---|
| 1879 | #D-* Purpose: build run file (deprecated) |
---|
| 1880 | #D-* Examples: |
---|
| 1881 | #D- |
---|
[771] | 1882 | function IGCM_sys_build_run_file { |
---|
| 1883 | |
---|
[811] | 1884 | IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " |
---|
[771] | 1885 | |
---|
| 1886 | } |
---|
| 1887 | |
---|
| 1888 | ############################################################ |
---|
| 1889 | # Build MPI/OMP scripts |
---|
[811] | 1890 | |
---|
| 1891 | #D-#================================================== |
---|
| 1892 | #D-function IGCM_sys_build_execution_scripts |
---|
| 1893 | #D-* Purpose: build execution scripts to be launch by ${HOST_MPIRUN_COMMAND} |
---|
| 1894 | #D-* Examples: |
---|
| 1895 | #D- |
---|
[771] | 1896 | function IGCM_sys_build_execution_scripts |
---|
| 1897 | { |
---|
| 1898 | IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ |
---|
| 1899 | if ( $DEBUG_sys ) ; then |
---|
| 1900 | echo "IGCM_sys_build_execution_scripts " $@ |
---|
| 1901 | fi |
---|
| 1902 | |
---|
| 1903 | EXECUTION=${HOST_MPIRUN_COMMAND} |
---|
| 1904 | |
---|
[1179] | 1905 | # MPMD mode |
---|
[771] | 1906 | if ( ${OK_PARA_MPMD} ) ; then |
---|
| 1907 | |
---|
| 1908 | if [ -f run_file ] ; then |
---|
| 1909 | IGCM_sys_Rm -f run_file |
---|
| 1910 | fi |
---|
| 1911 | touch run_file |
---|
| 1912 | |
---|
[1179] | 1913 | # Build run_file |
---|
[771] | 1914 | |
---|
[1179] | 1915 | # First loop on the components for the coupler ie oasis (only if oasis3) |
---|
| 1916 | # the coupler ie oasis3 must be the first one |
---|
[771] | 1917 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 1918 | |
---|
| 1919 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
| 1920 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
| 1921 | |
---|
| 1922 | # for CPL component only |
---|
| 1923 | if [ "X${comp}" = "XCPL" ] ; then |
---|
| 1924 | |
---|
| 1925 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
| 1926 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
[777] | 1927 | |
---|
| 1928 | if ( ${OK_PARA_MPI} ) ; then |
---|
| 1929 | (( mpi_count = 1 )) |
---|
| 1930 | until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do |
---|
| 1931 | echo "./${ExeNameOut}" >> run_file |
---|
| 1932 | (( mpi_count = mpi_count + 1 )) |
---|
| 1933 | done |
---|
| 1934 | else |
---|
| 1935 | echo "./${ExeNameOut} " >> run_file |
---|
| 1936 | fi |
---|
[771] | 1937 | fi |
---|
| 1938 | done |
---|
| 1939 | |
---|
[1179] | 1940 | # Then second loop on the components |
---|
[771] | 1941 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 1942 | |
---|
| 1943 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
| 1944 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
| 1945 | |
---|
| 1946 | # Only if we really have an executable for the component and not the coupler ie oasis: |
---|
| 1947 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then |
---|
| 1948 | |
---|
| 1949 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
| 1950 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
[777] | 1951 | |
---|
| 1952 | if ( ${OK_PARA_MPI} ) ; then |
---|
| 1953 | (( mpi_count = 1 )) |
---|
| 1954 | until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do |
---|
[1093] | 1955 | if ( ${OK_PARA_OMP} ) ; then |
---|
| 1956 | # Check if the number of threads is correct |
---|
| 1957 | case ${comp_proc_omp_loc} in |
---|
| 1958 | 1|2) |
---|
| 1959 | IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads" |
---|
| 1960 | ;; |
---|
| 1961 | 4|8|16) |
---|
| 1962 | IGCM_debug_Exit "ERROR with OMP parameters !" |
---|
| 1963 | IGCM_debug_Print 2 "Beware : ${comp_proc_omp_loc} is too much for MPMD mode" |
---|
| 1964 | IGCM_debug_Print 2 "You will use more CPU than needed" |
---|
| 1965 | IGCM_debug_Verif_Exit |
---|
| 1966 | ;; |
---|
| 1967 | *) |
---|
| 1968 | IGCM_debug_Exit "ERROR with OMP parameters !" |
---|
| 1969 | IGCM_debug_Print 2 "${comp_proc_omp_loc} is not possible as number of OMP threads" |
---|
| 1970 | IGCM_debug_Print 2 "Only 2,4,8,16 as number of OMP threads are possible " |
---|
| 1971 | IGCM_debug_Verif_Exit |
---|
| 1972 | ;; |
---|
| 1973 | esac |
---|
| 1974 | echo "env OMP_NUM_THREADS=$comp_proc_omp_loc ./${ExeNameOut}" >> run_file |
---|
| 1975 | else |
---|
| 1976 | echo "./${ExeNameOut}" >> run_file |
---|
| 1977 | fi |
---|
| 1978 | (( mpi_count = mpi_count + 1 )) |
---|
[777] | 1979 | done |
---|
| 1980 | else |
---|
[1093] | 1981 | echo "./${ExeNameOut} " >> run_file |
---|
[777] | 1982 | fi |
---|
[1093] | 1983 | if ( ${OK_PARA_OMP} ) ; then |
---|
| 1984 | export KMP_STACKSIZE=200m |
---|
| 1985 | fi |
---|
[771] | 1986 | fi |
---|
| 1987 | done |
---|
| 1988 | |
---|
| 1989 | EXECUTION="${HOST_MPIRUN_COMMAND} -pgmmodel mpmd -cmdfile ./run_file" |
---|
| 1990 | |
---|
| 1991 | IGCM_sys_Chmod u+x run_file |
---|
| 1992 | if ( $DEBUG_sys ) ; then |
---|
| 1993 | echo "run_file contains : " |
---|
| 1994 | cat run_file |
---|
| 1995 | fi |
---|
| 1996 | |
---|
[1179] | 1997 | else # Only one executable. (SPMD mode). |
---|
[771] | 1998 | |
---|
| 1999 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 2000 | |
---|
| 2001 | # Only if we really have an executable for the component : |
---|
| 2002 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
| 2003 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${ExeNameOut}" != "Xinca.dat" ] ) ; then |
---|
[847] | 2004 | |
---|
| 2005 | if ( ${OK_PARA_OMP} ) ; then |
---|
| 2006 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
[853] | 2007 | export KMP_STACKSIZE=200m |
---|
| 2008 | #export KMP_LIBRARY=turnaround |
---|
[847] | 2009 | #echo "export KMP_STACKSIZE=3g" >> script_${ExeNameOut}.ksh |
---|
| 2010 | #echo "export KMP_LIBRARY=turnaround" >> script_${ExeNameOut}.ksh |
---|
| 2011 | #echo "export MKL_SERIAL=YES" >> script_${ExeNameOut}.ksh |
---|
| 2012 | fi |
---|
[790] | 2013 | EXECUTION="${HOST_MPIRUN_COMMAND} ./${ExeNameOut}" |
---|
[771] | 2014 | fi |
---|
| 2015 | |
---|
| 2016 | done |
---|
| 2017 | |
---|
| 2018 | fi |
---|
| 2019 | |
---|
| 2020 | IGCM_debug_Print 1 "sys ada : execution command is " |
---|
| 2021 | IGCM_debug_Print 1 "$EXECUTION" |
---|
| 2022 | |
---|
| 2023 | IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" |
---|
| 2024 | } |
---|
| 2025 | |
---|
[933] | 2026 | #D-#================================================== |
---|
| 2027 | #D-function IGCM_sys_check_path |
---|
| 2028 | #D-* Purpose: check that RUN_DIR_PATH that will be removed on some machine |
---|
| 2029 | #D-* do not point to an important use directory. Stop immediately in that case. |
---|
| 2030 | #D-* Examples: |
---|
| 2031 | #D- |
---|
| 2032 | function IGCM_sys_check_path { |
---|
| 2033 | IGCM_debug_PushStack "IGCM_sys_check_path" |
---|
| 2034 | if ( $DEBUG_sys ) ; then |
---|
| 2035 | echo "IGCM_sys_check_path" |
---|
| 2036 | fi |
---|
[811] | 2037 | |
---|
[1012] | 2038 | if ( [ X${RUN_DIR_PATH} = X${HOME} ] || [ X${RUN_DIR_PATH} = X${WORKDIR} ] || [ X${RUN_DIR_PATH} = X${ARCHIVE} ] ) ; then |
---|
[933] | 2039 | IGCM_debug_Print 1 "Variable RUN_DIR_PATH is pointing to an important directory : ${RUN_DIR_PATH}" |
---|
| 2040 | IGCM_debug_Print 1 "Please check the RUN_DIR_PATH definition in your Job : Job_${config_UserChoices_JobName}" |
---|
[936] | 2041 | IGCM_debug_Exit "This will stop the job" |
---|
[933] | 2042 | fi |
---|
| 2043 | IGCM_debug_PopStack "IGCM_sys_check_path" |
---|
| 2044 | } |
---|
| 2045 | |
---|
[811] | 2046 | #D-#================================================== |
---|
| 2047 | #D-function IGCM_sys_check_quota |
---|
| 2048 | #D-* Purpose: check user quota. Stop the simulation if quota above 90% |
---|
| 2049 | #D-* Examples: |
---|
| 2050 | #D- |
---|
[771] | 2051 | function IGCM_sys_check_quota { |
---|
| 2052 | IGCM_debug_PushStack "IGCM_sys_check_quota" |
---|
| 2053 | if ( $DEBUG_sys ) ; then |
---|
[811] | 2054 | echo "IGCM_sys_check_quota" |
---|
[771] | 2055 | fi |
---|
| 2056 | # Limit of quota (in %) |
---|
| 2057 | limit_quota=90 |
---|
[811] | 2058 | |
---|
[771] | 2059 | # Check of the volume |
---|
[945] | 2060 | volume_quota=$(quota_u -w 2>/dev/null| grep 'Quota soft' | gawk '{print $5}') |
---|
[771] | 2061 | if [ ! X${volume_quota} = X ] ; then |
---|
| 2062 | quota_volume=${volume_quota%%\%} |
---|
| 2063 | # echo $quota_volume |
---|
[946] | 2064 | if [ $(echo "${quota_volume} > ${limit_quota}" | bc) -eq 1 ] ; then |
---|
[771] | 2065 | IGCM_debug_Print 1 "Please, check your quota of volume on workgpfs" |
---|
| 2066 | IGCM_debug_Print 1 "${quota_volume}% of your quota is used" |
---|
| 2067 | IGCM_debug_Print 1 "Use the quota_u -w command to check" |
---|
| 2068 | IGCM_debug_Print 1 "You must have more than 10% available to run" |
---|
| 2069 | IGCM_debug_Exit "Not enough space to run ! STOP HERE" |
---|
| 2070 | IGCM_debug_Verif_Exit |
---|
| 2071 | fi |
---|
| 2072 | |
---|
| 2073 | fi |
---|
| 2074 | IGCM_debug_PopStack "IGCM_sys_check_quota" |
---|
| 2075 | } |
---|
| 2076 | |
---|
| 2077 | #D-#================================================== |
---|
[958] | 2078 | #D-function IGCM_sys_GetJobID |
---|
| 2079 | #D-* Purpose: Check if job_name is currently |
---|
| 2080 | #D- running or in queue |
---|
[1179] | 2081 | #D-* Examples: IGCM_sys_GetJobID ${JobName} ${TargetUsr} JobID |
---|
[958] | 2082 | #D- |
---|
| 2083 | function IGCM_sys_GetJobID { |
---|
| 2084 | IGCM_debug_PushStack "IGCM_sys_GetJobID" |
---|
| 2085 | if ( $DEBUG_sys ) ; then |
---|
| 2086 | echo "IGCM_sys_GetJobID" |
---|
| 2087 | fi |
---|
| 2088 | |
---|
| 2089 | # Print only the full (-W) JobID (%id) and JobName (%jn) |
---|
| 2090 | ID=$( llq -u $2 -W -f %id %jn | \ |
---|
| 2091 | gawk -v JobName=$1 '( $NF ~ JobName ) { print $1 }' ) |
---|
| 2092 | |
---|
| 2093 | eval ${3}=${ID} |
---|
| 2094 | |
---|
| 2095 | IGCM_debug_PopStack "IGCM_sys_GetJobID" |
---|
| 2096 | } |
---|
| 2097 | |
---|
| 2098 | #D-#================================================== |
---|
[771] | 2099 | #D-function IGCM_sys_CountJobInQueue |
---|
| 2100 | #D-* Purpose: Check if job_name is currently |
---|
| 2101 | #D- running or in queue |
---|
| 2102 | #D-* Examples: IGCM_sys_CountJobInQueue ${JobName} NbRun |
---|
| 2103 | #D- |
---|
| 2104 | function IGCM_sys_CountJobInQueue { |
---|
| 2105 | IGCM_debug_PushStack "IGCM_sys_CountJobInQueue" |
---|
| 2106 | if ( $DEBUG_sys ) ; then |
---|
| 2107 | echo "IGCM_sys_CountJobInQueue" |
---|
| 2108 | fi |
---|
| 2109 | |
---|
| 2110 | # Print only the full (-W) JobName (%jn) |
---|
| 2111 | NbRun=$( llq -W -f %jn | grep -c "$1" ) |
---|
| 2112 | |
---|
| 2113 | eval ${2}=${NbRun} |
---|
| 2114 | |
---|
| 2115 | IGCM_debug_PopStack "IGCM_sys_CountJobInQueue" |
---|
| 2116 | } |
---|
| 2117 | |
---|
[955] | 2118 | #D-#================================================== |
---|
| 2119 | #D-function IGCM_sys_ListJobInQueue |
---|
| 2120 | #D-* Purpose: Check if job_name is currently |
---|
| 2121 | #D- running or in queue |
---|
| 2122 | #D-* Examples: IGCM_sys_ListJobInQueue ${User} JobNameList |
---|
| 2123 | #D- |
---|
| 2124 | function IGCM_sys_ListJobInQueue { |
---|
| 2125 | IGCM_debug_PushStack "IGCM_sys_ListJobInQueue" |
---|
| 2126 | if ( $DEBUG_sys ) ; then |
---|
| 2127 | echo "IGCM_sys_ListJobInQueue" |
---|
| 2128 | fi |
---|
| 2129 | |
---|
[960] | 2130 | # With -W option, column width is as large as necessary |
---|
| 2131 | set -A JobList $( llq -u $1 -W -f %jn | head -n -2 | tail -n +3 | \ |
---|
| 2132 | gawk '( $1 != /TS/ && \ |
---|
| 2133 | $1 !~ /PACK/ && \ |
---|
| 2134 | $1 !~ /REBUILD/ && \ |
---|
| 2135 | $1 !~ /pack/ ) \ |
---|
| 2136 | { print $1 }' | sed -e "s/\(.*\)\.[0-9]*/\1/" ) |
---|
[955] | 2137 | |
---|
| 2138 | eval set -A ${2} ${JobList[*]} |
---|
| 2139 | |
---|
| 2140 | IGCM_debug_PopStack "IGCM_sys_ListJobInQueue" |
---|
| 2141 | } |
---|
| 2142 | |
---|
[771] | 2143 | ############################################################## |
---|
| 2144 | # NCO OPERATOR |
---|
| 2145 | |
---|
[811] | 2146 | #D-#================================================== |
---|
| 2147 | #D-function IGCM_sys_ncap2 |
---|
| 2148 | #D-* Purpose: encapsulate ncap2 call so as to manage error code and retry |
---|
| 2149 | #D-* Examples: |
---|
| 2150 | #D- |
---|
[771] | 2151 | function IGCM_sys_ncap2 { |
---|
[1057] | 2152 | IGCM_debug_PushStack "IGCM_sys_ncap2" $@ |
---|
[771] | 2153 | if ( $DEBUG_sys ) ; then |
---|
| 2154 | echo "IGCM_sys_ncap2 :" $@ |
---|
| 2155 | fi |
---|
| 2156 | |
---|
| 2157 | typeset NB_ESSAI DELAI status i |
---|
| 2158 | # number of tentative |
---|
| 2159 | NB_ESSAI=3 |
---|
| 2160 | # time delay between tentative |
---|
| 2161 | DELAI=2 |
---|
| 2162 | |
---|
| 2163 | i=0 |
---|
| 2164 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 2165 | ncap2 -C "$@" > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 2166 | status=$? |
---|
| 2167 | if [ ${status} -gt 0 ] ; then |
---|
| 2168 | IGCM_debug_Print 2 "IGCM_sys_ncap2 : error code ${status}" |
---|
[1179] | 2169 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 2170 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2171 | IGCM_debug_Print 2 "IGCM_sys_ncap2 : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2172 | sleep $DELAI |
---|
| 2173 | else |
---|
[1179] | 2174 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2175 | break |
---|
| 2176 | fi |
---|
| 2177 | (( i = i + 1 )) |
---|
| 2178 | done |
---|
| 2179 | |
---|
| 2180 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2181 | echo "IGCM_sys_ncap2 : ncap2 error" |
---|
| 2182 | IGCM_debug_Exit "ncap2" |
---|
[771] | 2183 | fi |
---|
| 2184 | |
---|
| 2185 | IGCM_debug_PopStack "IGCM_sys_ncap2" |
---|
| 2186 | } |
---|
| 2187 | |
---|
[811] | 2188 | #D-#================================================== |
---|
| 2189 | #D-function IGCM_sys_ncatted |
---|
| 2190 | #D-* Purpose: encapsulate ncatted call so as to manage error code and retry |
---|
| 2191 | #D-* Examples: |
---|
| 2192 | #D- |
---|
[771] | 2193 | function IGCM_sys_ncatted { |
---|
[1057] | 2194 | IGCM_debug_PushStack "IGCM_sys_ncatted" $@ |
---|
[771] | 2195 | if ( $DEBUG_sys ) ; then |
---|
| 2196 | echo "IGCM_sys_ncatted :" $@ |
---|
| 2197 | fi |
---|
| 2198 | |
---|
| 2199 | typeset NB_ESSAI DELAI status i |
---|
| 2200 | # number of tentative |
---|
| 2201 | NB_ESSAI=3 |
---|
| 2202 | # time delay between tentative |
---|
| 2203 | DELAI=2 |
---|
| 2204 | |
---|
| 2205 | i=0 |
---|
| 2206 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 2207 | ncatted "$@" > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 2208 | status=$? |
---|
| 2209 | if [ ${status} -gt 0 ] ; then |
---|
| 2210 | IGCM_debug_Print 2 "IGCM_sys_ncatted : error code ${status}" |
---|
[1179] | 2211 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 2212 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2213 | IGCM_debug_Print 2 "IGCM_sys_ncatted : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2214 | sleep $DELAI |
---|
| 2215 | else |
---|
[1179] | 2216 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2217 | break |
---|
| 2218 | fi |
---|
| 2219 | (( i = i + 1 )) |
---|
| 2220 | done |
---|
| 2221 | |
---|
| 2222 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2223 | echo "IGCM_sys_ncatted : ncatted error" |
---|
| 2224 | IGCM_debug_Exit "ncatted" |
---|
[771] | 2225 | fi |
---|
| 2226 | |
---|
| 2227 | IGCM_debug_PopStack "IGCM_sys_ncatted" |
---|
| 2228 | } |
---|
| 2229 | |
---|
[811] | 2230 | #D-#================================================== |
---|
| 2231 | #D-function IGCM_sys_ncbo |
---|
| 2232 | #D-* Purpose: encapsulate ncbo call so as to manage error code and retry |
---|
| 2233 | #D-* Examples: |
---|
| 2234 | #D- |
---|
[771] | 2235 | function IGCM_sys_ncbo { |
---|
[1057] | 2236 | IGCM_debug_PushStack "IGCM_sys_ncbo" $@ |
---|
[771] | 2237 | if ( $DEBUG_sys ) ; then |
---|
| 2238 | echo "IGCM_sys_ncbo :" $@ |
---|
| 2239 | fi |
---|
| 2240 | |
---|
| 2241 | typeset NB_ESSAI DELAI status i |
---|
| 2242 | # number of tentative |
---|
| 2243 | NB_ESSAI=3 |
---|
| 2244 | # time delay between tentative |
---|
| 2245 | DELAI=2 |
---|
| 2246 | |
---|
| 2247 | i=0 |
---|
| 2248 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 2249 | ncbo -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 2250 | status=$? |
---|
| 2251 | if [ ${status} -gt 0 ] ; then |
---|
| 2252 | IGCM_debug_Print 2 "IGCM_sys_ncbo : error code ${status}" |
---|
[1179] | 2253 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 2254 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2255 | IGCM_debug_Print 2 "IGCM_sys_ncbo : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2256 | sleep $DELAI |
---|
| 2257 | else |
---|
[1179] | 2258 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2259 | break |
---|
| 2260 | fi |
---|
| 2261 | (( i = i + 1 )) |
---|
| 2262 | done |
---|
| 2263 | |
---|
| 2264 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2265 | echo "IGCM_sys_ncbo : ncbo error" |
---|
| 2266 | IGCM_debug_Exit "ncbo" |
---|
[771] | 2267 | fi |
---|
| 2268 | |
---|
| 2269 | IGCM_debug_PopStack "IGCM_sys_ncbo" |
---|
| 2270 | } |
---|
| 2271 | |
---|
[811] | 2272 | #D-#================================================== |
---|
| 2273 | #D-function IGCM_sys_ncdif |
---|
| 2274 | #D-* Purpose: encapsulate ncdiff call so as to manage error code and retry |
---|
| 2275 | #D-* Examples: |
---|
| 2276 | #D- |
---|
[771] | 2277 | function IGCM_sys_ncdiff { |
---|
[1057] | 2278 | IGCM_debug_PushStack "IGCM_sys_ncdiff" $@ |
---|
[771] | 2279 | if ( $DEBUG_sys ) ; then |
---|
| 2280 | echo "IGCM_sys_ncdiff :" $@ |
---|
| 2281 | fi |
---|
| 2282 | |
---|
| 2283 | typeset NB_ESSAI DELAI status i |
---|
| 2284 | # number of tentative |
---|
| 2285 | NB_ESSAI=3 |
---|
| 2286 | # time delay between tentative |
---|
| 2287 | DELAI=2 |
---|
| 2288 | |
---|
| 2289 | i=0 |
---|
| 2290 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 2291 | ncdiff -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 2292 | status=$? |
---|
| 2293 | if [ ${status} -gt 0 ] ; then |
---|
| 2294 | IGCM_debug_Print 2 "IGCM_sys_ncdiff : error code ${status}" |
---|
[1179] | 2295 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 2296 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2297 | IGCM_debug_Print 2 "IGCM_sys_ncdiff : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2298 | sleep $DELAI |
---|
| 2299 | else |
---|
[1179] | 2300 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2301 | break |
---|
| 2302 | fi |
---|
| 2303 | (( i = i + 1 )) |
---|
| 2304 | done |
---|
| 2305 | |
---|
| 2306 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2307 | echo "IGCM_sys_ncdiff : ncdiff error" |
---|
| 2308 | IGCM_debug_Exit "ncdiff" |
---|
[771] | 2309 | fi |
---|
| 2310 | |
---|
| 2311 | IGCM_debug_PopStack "IGCM_sys_ncdiff" |
---|
| 2312 | } |
---|
| 2313 | |
---|
[811] | 2314 | #D-#================================================== |
---|
| 2315 | #D-function IGCM_sys_ncea |
---|
| 2316 | #D-* Purpose: encapsulate ncea call so as to manage error code and retry |
---|
| 2317 | #D-* Examples: |
---|
| 2318 | #D- |
---|
[771] | 2319 | function IGCM_sys_ncea { |
---|
[1057] | 2320 | IGCM_debug_PushStack "IGCM_sys_ncea" $@ |
---|
[771] | 2321 | if ( $DEBUG_sys ) ; then |
---|
| 2322 | echo "IGCM_sys_ncea :" $@ |
---|
| 2323 | fi |
---|
| 2324 | |
---|
| 2325 | typeset NB_ESSAI DELAI status i |
---|
| 2326 | # number of tentative |
---|
| 2327 | NB_ESSAI=3 |
---|
| 2328 | # time delay between tentative |
---|
| 2329 | DELAI=2 |
---|
| 2330 | |
---|
| 2331 | i=0 |
---|
| 2332 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 2333 | ncea -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 2334 | status=$? |
---|
| 2335 | if [ ${status} -gt 0 ] ; then |
---|
| 2336 | IGCM_debug_Print 2 "IGCM_sys_ncea : error code ${status}" |
---|
[1179] | 2337 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 2338 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2339 | IGCM_debug_Print 2 "IGCM_sys_ncea : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2340 | sleep $DELAI |
---|
| 2341 | else |
---|
[1179] | 2342 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2343 | break |
---|
| 2344 | fi |
---|
| 2345 | (( i = i + 1 )) |
---|
| 2346 | done |
---|
| 2347 | |
---|
| 2348 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2349 | echo "IGCM_sys_ncea : ncea error" |
---|
| 2350 | IGCM_debug_Exit "ncea" |
---|
[771] | 2351 | fi |
---|
| 2352 | |
---|
| 2353 | IGCM_debug_PopStack "IGCM_sys_ncea" |
---|
| 2354 | } |
---|
| 2355 | |
---|
[811] | 2356 | #D-#================================================== |
---|
| 2357 | #D-function IGCM_sys_ncecat |
---|
| 2358 | #D-* Purpose: encapsulate ncecat call so as to manage error code and retry |
---|
| 2359 | #D-* Examples: |
---|
| 2360 | #D- |
---|
[771] | 2361 | function IGCM_sys_ncecat { |
---|
[1057] | 2362 | IGCM_debug_PushStack "IGCM_sys_ncecat" $@ |
---|
[771] | 2363 | if ( $DEBUG_sys ) ; then |
---|
| 2364 | echo "IGCM_sys_ncecat :" $@ |
---|
| 2365 | fi |
---|
| 2366 | |
---|
| 2367 | typeset NB_ESSAI DELAI status i |
---|
| 2368 | # number of tentative |
---|
| 2369 | NB_ESSAI=3 |
---|
| 2370 | # time delay between tentative |
---|
| 2371 | DELAI=2 |
---|
| 2372 | |
---|
| 2373 | i=0 |
---|
| 2374 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 2375 | ncecat -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 2376 | status=$? |
---|
| 2377 | if [ ${status} -gt 0 ] ; then |
---|
| 2378 | IGCM_debug_Print 2 "IGCM_sys_ncecat : error code ${status}" |
---|
[1179] | 2379 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 2380 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2381 | IGCM_debug_Print 2 "IGCM_sys_ncecat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2382 | sleep $DELAI |
---|
| 2383 | else |
---|
[1179] | 2384 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2385 | break |
---|
| 2386 | fi |
---|
| 2387 | (( i = i + 1 )) |
---|
| 2388 | done |
---|
| 2389 | |
---|
| 2390 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2391 | echo "IGCM_sys_ncecat : ncecat error" |
---|
| 2392 | IGCM_debug_Exit "ncecat" |
---|
[771] | 2393 | fi |
---|
| 2394 | |
---|
| 2395 | IGCM_debug_PopStack "IGCM_sys_ncecat" |
---|
| 2396 | } |
---|
| 2397 | |
---|
[811] | 2398 | #D-#================================================== |
---|
| 2399 | #D-function IGCM_sys_ncflint |
---|
| 2400 | #D-* Purpose: encapsulate ncflint call so as to manage error code and retry |
---|
| 2401 | #D-* Examples: |
---|
| 2402 | #D- |
---|
[771] | 2403 | function IGCM_sys_ncflint { |
---|
[1057] | 2404 | IGCM_debug_PushStack "IGCM_sys_ncflint" $@ |
---|
[771] | 2405 | if ( $DEBUG_sys ) ; then |
---|
| 2406 | echo "IGCM_sys_ncflint :" $@ |
---|
| 2407 | fi |
---|
| 2408 | |
---|
| 2409 | typeset NB_ESSAI DELAI status i |
---|
| 2410 | # number of tentative |
---|
| 2411 | NB_ESSAI=3 |
---|
| 2412 | # time delay between tentative |
---|
| 2413 | DELAI=2 |
---|
| 2414 | |
---|
| 2415 | i=0 |
---|
| 2416 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 2417 | ncflint -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 2418 | status=$? |
---|
| 2419 | if [ ${status} -gt 0 ] ; then |
---|
| 2420 | IGCM_debug_Print 2 "IGCM_sys_ncflint : error code ${status}" |
---|
[1179] | 2421 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 2422 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2423 | IGCM_debug_Print 2 "IGCM_sys_ncflint : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2424 | sleep $DELAI |
---|
| 2425 | else |
---|
[1179] | 2426 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2427 | break |
---|
| 2428 | fi |
---|
| 2429 | (( i = i + 1 )) |
---|
| 2430 | done |
---|
| 2431 | |
---|
| 2432 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2433 | echo "IGCM_sys_ncflint : ncflint error" |
---|
| 2434 | IGCM_debug_Exit "ncflint" |
---|
[771] | 2435 | fi |
---|
| 2436 | |
---|
| 2437 | IGCM_debug_PopStack "IGCM_sys_ncflint" |
---|
| 2438 | } |
---|
| 2439 | |
---|
[811] | 2440 | #D-#================================================== |
---|
| 2441 | #D-function IGCM_sys_ncks |
---|
| 2442 | #D-* Purpose: encapsulate ncks call so as to manage error code and retry |
---|
| 2443 | #D-* Examples: |
---|
| 2444 | #D- |
---|
[771] | 2445 | function IGCM_sys_ncks { |
---|
[1057] | 2446 | IGCM_debug_PushStack "IGCM_sys_ncks" $@ |
---|
[771] | 2447 | if ( $DEBUG_sys ) ; then |
---|
| 2448 | echo "IGCM_sys_ncks :" $@ |
---|
| 2449 | fi |
---|
| 2450 | |
---|
| 2451 | typeset NB_ESSAI DELAI status i |
---|
| 2452 | # number of tentative |
---|
| 2453 | NB_ESSAI=3 |
---|
| 2454 | # time delay between tentative |
---|
| 2455 | DELAI=2 |
---|
| 2456 | |
---|
| 2457 | i=0 |
---|
| 2458 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 2459 | ncks -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 2460 | status=$? |
---|
| 2461 | if [ ${status} -gt 0 ] ; then |
---|
| 2462 | IGCM_debug_Print 2 "IGCM_sys_ncks : error code ${status}" |
---|
[1179] | 2463 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 2464 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2465 | IGCM_debug_Print 2 "IGCM_sys_ncks : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2466 | sleep $DELAI |
---|
| 2467 | else |
---|
[1179] | 2468 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2469 | break |
---|
| 2470 | fi |
---|
| 2471 | (( i = i + 1 )) |
---|
| 2472 | done |
---|
| 2473 | |
---|
| 2474 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2475 | echo "IGCM_sys_ncks : ncks error" |
---|
| 2476 | IGCM_debug_Exit "ncks" |
---|
[771] | 2477 | fi |
---|
| 2478 | |
---|
| 2479 | IGCM_debug_PopStack "IGCM_sys_ncks" |
---|
| 2480 | } |
---|
| 2481 | |
---|
[811] | 2482 | #D-#================================================== |
---|
| 2483 | #D-function IGCM_sys_ncpdq |
---|
| 2484 | #D-* Purpose: encapsulate ncpdq call so as to manage error code and retry |
---|
| 2485 | #D-* Examples: |
---|
| 2486 | #D- |
---|
[771] | 2487 | function IGCM_sys_ncpdq { |
---|
[1057] | 2488 | IGCM_debug_PushStack "IGCM_sys_ncpdq" $@ |
---|
[771] | 2489 | if ( $DEBUG_sys ) ; then |
---|
| 2490 | echo "IGCM_sys_ncpdq :" $@ |
---|
| 2491 | fi |
---|
| 2492 | |
---|
| 2493 | typeset NB_ESSAI DELAI status i |
---|
| 2494 | # number of tentative |
---|
| 2495 | NB_ESSAI=3 |
---|
| 2496 | # time delay between tentative |
---|
| 2497 | DELAI=2 |
---|
| 2498 | |
---|
| 2499 | i=0 |
---|
| 2500 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 2501 | ncpdq -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 2502 | status=$? |
---|
| 2503 | if [ ${status} -gt 0 ] ; then |
---|
| 2504 | IGCM_debug_Print 2 "IGCM_sys_ncpdq : error code ${status}" |
---|
[1179] | 2505 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 2506 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2507 | IGCM_debug_Print 2 "IGCM_sys_ncpdq : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2508 | sleep $DELAI |
---|
| 2509 | else |
---|
[1179] | 2510 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2511 | break |
---|
| 2512 | fi |
---|
| 2513 | (( i = i + 1 )) |
---|
| 2514 | done |
---|
| 2515 | |
---|
| 2516 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2517 | echo "IGCM_sys_ncpdq : ncpdq error" |
---|
| 2518 | IGCM_debug_Exit "ncpdq" |
---|
[771] | 2519 | fi |
---|
| 2520 | |
---|
| 2521 | IGCM_debug_PopStack "IGCM_sys_ncpdq" |
---|
| 2522 | } |
---|
| 2523 | |
---|
[811] | 2524 | #D-#================================================== |
---|
| 2525 | #D-function IGCM_sys_ncra |
---|
| 2526 | #D-* Purpose: encapsulate ncra call so as to manage error code and retry |
---|
| 2527 | #D-* Examples: |
---|
| 2528 | #D- |
---|
[771] | 2529 | function IGCM_sys_ncra { |
---|
[1057] | 2530 | IGCM_debug_PushStack "IGCM_sys_ncra" $@ |
---|
[771] | 2531 | if ( $DEBUG_sys ) ; then |
---|
| 2532 | echo "IGCM_sys_ncra :" $@ |
---|
| 2533 | fi |
---|
| 2534 | |
---|
| 2535 | typeset NB_ESSAI DELAI status i |
---|
| 2536 | # number of tentative |
---|
| 2537 | NB_ESSAI=3 |
---|
| 2538 | # time delay between tentative |
---|
| 2539 | DELAI=2 |
---|
| 2540 | |
---|
| 2541 | i=0 |
---|
| 2542 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 2543 | ncra -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 2544 | status=$? |
---|
| 2545 | if [ ${status} -gt 0 ] ; then |
---|
| 2546 | IGCM_debug_Print 2 "IGCM_sys_ncra : error code ${status}" |
---|
[1179] | 2547 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 2548 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2549 | IGCM_debug_Print 2 "IGCM_sys_ncra : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2550 | sleep $DELAI |
---|
| 2551 | else |
---|
[1179] | 2552 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2553 | break |
---|
| 2554 | fi |
---|
| 2555 | (( i = i + 1 )) |
---|
| 2556 | done |
---|
| 2557 | |
---|
| 2558 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2559 | echo "IGCM_sys_ncra : ncra error" |
---|
| 2560 | IGCM_debug_Exit "ncra" |
---|
[771] | 2561 | fi |
---|
| 2562 | |
---|
| 2563 | IGCM_debug_PopStack "IGCM_sys_ncra" |
---|
| 2564 | } |
---|
| 2565 | |
---|
[811] | 2566 | #D-#================================================== |
---|
| 2567 | #D-function IGCM_sys_ncrcat |
---|
| 2568 | #D-* Purpose: encapsulate ncrcat call so as to manage error code and retry |
---|
| 2569 | #D-* Examples: |
---|
| 2570 | #D- |
---|
[771] | 2571 | function IGCM_sys_ncrcat { |
---|
[1057] | 2572 | IGCM_debug_PushStack "IGCM_sys_ncrcat" $@ |
---|
[771] | 2573 | if ( $DEBUG_sys ) ; then |
---|
| 2574 | echo "IGCM_sys_ncrcat :" $@ |
---|
| 2575 | fi |
---|
| 2576 | |
---|
| 2577 | typeset NB_ESSAI DELAI status i lastArg |
---|
| 2578 | # number of tentative |
---|
| 2579 | NB_ESSAI=3 |
---|
| 2580 | # time delay between tentative |
---|
| 2581 | DELAI=2 |
---|
| 2582 | |
---|
| 2583 | i=0 |
---|
| 2584 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 2585 | ncrcat -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 2586 | status=$? |
---|
| 2587 | if [ ${status} -gt 0 ] ; then |
---|
| 2588 | IGCM_debug_Print 2 "IGCM_sys_ncrcat : error code ${status}" |
---|
[1179] | 2589 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 2590 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2591 | IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2592 | sleep $DELAI |
---|
[1179] | 2593 | elif [ ! "X$( grep "WARNING Intra-file non-monotonicity" ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ )" = "X" ] ; then |
---|
[771] | 2594 | IGCM_debug_Print 2 "IGCM_sys_ncrcat : WARNING Intra-file non-monotonicity" |
---|
[1179] | 2595 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2596 | # remove files having corrupted time axis |
---|
| 2597 | eval lastArg=\${$#} |
---|
| 2598 | IGCM_debug_Print 2 "IGCM_sys_ncrcat : Delete ${lastArg}" |
---|
| 2599 | \rm ${lastArg} |
---|
[1179] | 2600 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2601 | IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2602 | sleep $DELAI |
---|
| 2603 | else |
---|
[1179] | 2604 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2605 | break |
---|
| 2606 | fi |
---|
| 2607 | (( i = i + 1 )) |
---|
| 2608 | done |
---|
| 2609 | |
---|
| 2610 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2611 | echo "IGCM_sys_ncrcat : ncrcat error" |
---|
| 2612 | #IGCM_debug_Exit "ncrcat" |
---|
[771] | 2613 | fi |
---|
| 2614 | |
---|
| 2615 | IGCM_debug_PopStack "IGCM_sys_ncrcat" |
---|
| 2616 | } |
---|
| 2617 | |
---|
[811] | 2618 | #D-#================================================== |
---|
| 2619 | #D-function IGCM_sys_ncrename |
---|
| 2620 | #D-* Purpose: encapsulate ncrename call so as to manage error code and retry |
---|
| 2621 | #D-* Examples: |
---|
| 2622 | #D- |
---|
[771] | 2623 | function IGCM_sys_ncrename { |
---|
[1057] | 2624 | IGCM_debug_PushStack "IGCM_sys_ncrename" $@ |
---|
[771] | 2625 | if ( $DEBUG_sys ) ; then |
---|
| 2626 | echo "IGCM_sys_ncrename :" $@ |
---|
| 2627 | fi |
---|
| 2628 | |
---|
| 2629 | typeset NB_ESSAI DELAI status i |
---|
| 2630 | # number of tentative |
---|
| 2631 | NB_ESSAI=3 |
---|
| 2632 | # time delay between tentative |
---|
| 2633 | DELAI=2 |
---|
| 2634 | |
---|
| 2635 | i=0 |
---|
| 2636 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 2637 | ncrename $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 2638 | status=$? |
---|
| 2639 | if [ ${status} -gt 0 ] ; then |
---|
| 2640 | IGCM_debug_Print 2 "IGCM_sys_ncrename : error code ${status}" |
---|
[1179] | 2641 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 2642 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2643 | IGCM_debug_Print 2 "IGCM_sys_ncrename : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2644 | sleep $DELAI |
---|
| 2645 | else |
---|
[1179] | 2646 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2647 | break |
---|
| 2648 | fi |
---|
| 2649 | (( i = i + 1 )) |
---|
| 2650 | done |
---|
| 2651 | |
---|
| 2652 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2653 | echo "IGCM_sys_ncrename : ncrename error" |
---|
| 2654 | IGCM_debug_Exit "ncrename" |
---|
[771] | 2655 | fi |
---|
| 2656 | |
---|
| 2657 | IGCM_debug_PopStack "IGCM_sys_ncrename" |
---|
| 2658 | } |
---|
| 2659 | |
---|
[811] | 2660 | #D-#================================================== |
---|
| 2661 | #D-function IGCM_sys_ncwa |
---|
| 2662 | #D-* Purpose: encapsulate ncwa call so as to manage error code and retry |
---|
| 2663 | #D-* Examples: |
---|
| 2664 | #D- |
---|
[771] | 2665 | function IGCM_sys_ncwa { |
---|
[1057] | 2666 | IGCM_debug_PushStack "IGCM_sys_ncwa" $@ |
---|
[771] | 2667 | if ( $DEBUG_sys ) ; then |
---|
| 2668 | echo "IGCM_sys_ncwa :" $@ |
---|
| 2669 | fi |
---|
| 2670 | |
---|
| 2671 | typeset NB_ESSAI DELAI status i |
---|
| 2672 | # number of tentative |
---|
| 2673 | NB_ESSAI=3 |
---|
| 2674 | # time delay between tentative |
---|
| 2675 | DELAI=2 |
---|
| 2676 | |
---|
| 2677 | i=0 |
---|
| 2678 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[1179] | 2679 | ncwa -C $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 2680 | status=$? |
---|
| 2681 | if [ ${status} -gt 0 ] ; then |
---|
| 2682 | IGCM_debug_Print 2 "IGCM_sys_ncwa : error code ${status}" |
---|
[1179] | 2683 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 2684 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2685 | IGCM_debug_Print 2 "IGCM_sys_ncwa : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2686 | sleep $DELAI |
---|
| 2687 | else |
---|
[1179] | 2688 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2689 | break |
---|
| 2690 | fi |
---|
| 2691 | (( i = i + 1 )) |
---|
| 2692 | done |
---|
| 2693 | |
---|
| 2694 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2695 | echo "IGCM_sys_ncwa : ncwa error" |
---|
| 2696 | IGCM_debug_Exit "ncwa" |
---|
[771] | 2697 | fi |
---|
| 2698 | |
---|
| 2699 | IGCM_debug_PopStack "IGCM_sys_ncwa" |
---|
| 2700 | } |
---|
| 2701 | |
---|
| 2702 | ############################################################## |
---|
| 2703 | # CDO OPERATOR |
---|
| 2704 | |
---|
[811] | 2705 | #D-#================================================== |
---|
| 2706 | #D-function IGCM_sys_cdo |
---|
| 2707 | #D-* Purpose: encapsulate cdo call so as to manage error code and retry |
---|
| 2708 | #D-* Examples: |
---|
| 2709 | #D- |
---|
[771] | 2710 | function IGCM_sys_cdo { |
---|
[1057] | 2711 | IGCM_debug_PushStack "IGCM_sys_cdo" $@ |
---|
[771] | 2712 | if ( $DEBUG_sys ) ; then |
---|
| 2713 | echo "IGCM_sys_cdo :" $@ |
---|
| 2714 | fi |
---|
| 2715 | |
---|
| 2716 | typeset status |
---|
| 2717 | |
---|
[1179] | 2718 | \cdo $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 |
---|
[771] | 2719 | status=$? |
---|
| 2720 | if [ ${status} -gt 0 ] ; then |
---|
| 2721 | echo "IGCM_sys_cdo : error code ${status}" |
---|
[1179] | 2722 | cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
| 2723 | \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ |
---|
[771] | 2724 | IGCM_debug_PopStack "IGCM_sys_cdo" |
---|
| 2725 | return 1 |
---|
| 2726 | else |
---|
| 2727 | IGCM_debug_PopStack "IGCM_sys_cdo" |
---|
| 2728 | return 0 |
---|
| 2729 | fi |
---|
| 2730 | |
---|
| 2731 | IGCM_debug_PopStack "IGCM_sys_cdo" |
---|
| 2732 | } |
---|