- Timestamp:
- 06/05/12 16:31:28 (12 years ago)
- Location:
- trunk/libIGCM/libIGCM_sys
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_sys/libIGCM_sys_cesium.ksh
r664 r676 1 #!/bin/ksh 1 #!/bin/ksh 2 2 3 3 #************************************************************** … … 14 14 #========================================================= 15 15 # The documentation of this file can be automatically generated 16 # if you use the prefix #D- for comments to be extracted. 16 # if you use the prefix #D- for comments to be extracted. 17 17 # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" 18 18 #========================================================= … … 22 22 #D-#================================================== 23 23 #D- 24 #D- This ksh library if a layer under some usefull 24 #D- This ksh library if a layer under some usefull 25 25 #D-environment variables and shell commands. 26 26 #D-All those definitions depend on host particularities. … … 62 62 63 63 #===================================================== 64 # Host and user names 64 # Host and user names 65 65 # $hostname ou hostname 66 66 typeset HOST=${HOST:=$( hostname )} … … 104 104 105 105 #==================================================== 106 # For interactive jobs on cesium 106 # For interactive jobs on cesium 107 107 PBS_O_WORKDIR=${PBS_O_WORKDIR:=$(pwd)} 108 108 … … 117 117 #- ARCHIVE (dedicated to small/medium files) 118 118 typeset -r STORAGE=${CCCWORKDIR} 119 120 #====================================================121 119 122 120 #==================================================== … … 327 325 fi 328 326 #- creation de repertoire sur le serveur fichier 329 if [ ! -d ${1} ]; then 327 if [ ! -d ${1} ]; then 330 328 \mkdir -p $1 331 329 if [ $? -gt 0 ] ; then … … 348 346 fi 349 347 #- creation de repertoire sur le serveur fichier 350 if [ ! -d ${1} ]; then 348 if [ ! -d ${1} ]; then 351 349 \mkdir -p $1 352 350 if [ $? -gt 0 ] ; then … … 511 509 #D-#================================================== 512 510 #D-function IGCM_sys_CountFileBuffer 513 #D-* Purpose: Count files on MasterScratch filesystem511 #D-* Purpose: Count files on Scratch filesystem 514 512 #D-* Examples: 515 513 #D- … … 612 610 613 611 #D-************************* 614 #D- File transfer functions 612 #D- File transfer functions 615 613 #D-************************* 616 614 #D- … … 681 679 elif [ $MYLANG = "en" ] ; then 682 680 case $RET in 683 0) return;; 681 0) return;; 684 682 1) echo "rsync error : Syntax or usage error " 685 683 return;; … … 822 820 823 821 typeset RET 824 822 825 823 echo mv $@ > out_rsync 2>&1 826 824 \mv $@ >> out_rsync 2>&1 827 825 RET=$? 828 826 829 827 if [ ${RET} -gt 0 ] ; then 830 828 echo "IGCM_sys_Mv : error in mv." … … 934 932 935 933 typeset TEST NB_ESSAI DELAI status i 936 934 937 935 TEST=$( IGCM_sys_RshMaster ( [ -d $1 ] || [ -f $1 ] ) && echo 1 || echo 0 ) 938 936 if [ ${TEST} -ne 1 ] ; then … … 949 947 (( i = 0 )) 950 948 while [ $i -lt $NB_ESSAI ] ; do 951 949 #USUAL WAY 952 950 scp -r ${MASTER}:$1 $2 > out_rsync 2>&1 953 951 status=$? 954 952 if [ ${status} -gt 0 ]; then 955 956 957 953 IGCM_debug_Print 2 "IGCM_sys_Get_Master : scp failed ${i}/${NB_ESSAI}" 954 IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." 955 sleep $DELAI 958 956 else 959 957 break 960 958 fi 961 959 (( i = i + 1 )) … … 1003 1001 RET=$? 1004 1002 1005 # 1006 # 1007 # 1008 1009 # 1010 # 1011 # 1012 1013 # 1014 # 1015 1016 # 1017 # 1003 # #RSYNC WITH NETWORK SSH CALL 1004 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 1005 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 1006 1007 # #RSYNC WITH NFS USE 1008 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 1009 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 1010 1011 # RET=$? 1012 # IGCM_sys_Rsync_out $RET 1013 1014 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1015 # (( RET=RET+$? )) 1018 1016 1019 1017 if [ ${RET} -gt 0 ] ; then … … 1040 1038 echo "IGCM_sys_Put_Out :" $@ 1041 1039 fi 1040 1041 typeset NB_ESSAI DELAI RET i exist skip 1042 1043 # number of tentative 1044 NB_ESSAI=3 1045 # time delay between tentative 1046 DELAI=2 1047 1042 1048 if [ $DRYRUN = 0 ]; then 1043 1049 if [ ! -f ${1} ] ; then … … 1049 1055 IGCM_sys_MkdirArchive $( dirname $2 ) 1050 1056 # 1051 typeset RET exist skip1052 1057 1053 1058 #===================================================== … … 1059 1064 # typeset WORKPATH FILEPATH 1060 1065 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" ) 1061 # IGCM_sys_MkdirWork ${WORKPATH} 1066 # IGCM_sys_MkdirWork ${WORKPATH} 1062 1067 # FILEPATH=${WORKPATH}/$( basename $2 ) 1063 1068 # # … … 1067 1072 if [ X${JobType} = XRUN ] ; then 1068 1073 if [ X${3} = X ] ; then 1069 1074 IGCM_sys_Chmod 444 ${1} 1070 1075 fi 1071 1076 fi 1077 # 1072 1078 1073 1079 exist=false … … 1079 1085 exist=true 1080 1086 if [ "X$( diff $1 $2 )" = X ] ; then 1081 1082 1087 IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 1088 skip=true 1083 1089 else 1084 1085 1090 IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 1091 skip=false 1086 1092 fi 1087 1093 fi 1088 #1094 # 1089 1095 if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 1090 1096 IGCM_sys_Chmod u+w $2 1091 1097 fi 1092 # USUAL WAY 1098 1093 1099 if [ X${skip} = Xfalse ] ; then 1094 cp $1 $2 > out_rsync 2>&1 1095 RET=$? 1096 if [ ${RET} -gt 0 ] ; then 1097 echo "IGCM_sys_Put_Out : error." 1098 cat out_rsync 1099 IGCM_debug_Exit "IGCM_sys_Put_Out" 1100 else 1101 \rm out_rsync 1102 fi 1103 fi 1104 1105 # #RSYNC WITH NETWORK RSH CALL 1106 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1 1107 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1 1108 1109 # #RSYNC WITH NFS USE 1110 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 1111 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 1112 1113 # RET=$? 1114 # IGCM_sys_Rsync_out $RET 1115 1116 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1117 # (( RET=RET+$? )) 1118 1119 1100 (( i = 0 )) 1101 while [ $i -lt $NB_ESSAI ] ; do 1102 # USUAL WAY 1103 \cp $1 $2 > out_rsync 2>&1 1104 RET=$? 1105 if [ ${RET} -gt 0 ]; then 1106 IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}" 1107 IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 1108 sleep $DELAI 1109 else 1110 break 1111 fi 1112 (( i = i + 1 )) 1113 done 1114 fi 1115 1116 # #RSYNC WITH NETWORK RSH CALL 1117 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1 1118 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1 1119 1120 # #RSYNC WITH NFS USE 1121 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 1122 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 1123 1124 # RET=$? 1125 # IGCM_sys_Rsync_out $RET 1126 1127 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1128 # (( RET=RET+$? )) 1129 1130 if [ ${RET} -gt 0 ] ; then 1131 echo "IGCM_sys_Put_Out : error." 1132 cat out_rsync 1133 IGCM_debug_Exit "IGCM_sys_Put_Out" 1134 else 1135 \rm out_rsync 1136 fi 1120 1137 else 1121 1138 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack … … 1133 1150 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1134 1151 1135 typeset DEST RET dm_liste ifile target file_work 1152 typeset DEST RET dm_liste ifile target file_work 1153 typeset NB_ESSAI DELAI status i 1136 1154 1137 1155 if ( $DEBUG_sys ) ; then 1138 1156 echo "IGCM_sys_Get :" $@ 1139 1157 fi 1158 1159 # number of tentative 1160 NB_ESSAI=3 1161 # time delay between tentative 1162 DELAI=2 1163 1140 1164 if [ $DRYRUN -le 2 ]; then 1141 1165 if [ X${1} = X'/l' ] ; then … … 1163 1187 #fi 1164 1188 1165 # test if the (first) file is present in the old computation :1166 IGCM_sys_TestFileArchive ${dm_liste[0]}1167 RET=$?1168 if [ ${RET} -gt 0 ] ; then1169 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."1170 IGCM_debug_Exit "IGCM_sys_Get"1171 fi1172 1173 #dmget ${dm_liste[*]} > out_rsync 2>&11174 1189 ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 1175 1190 RET=$? … … 1190 1205 # RET=$? 1191 1206 # if [ ${RET} -gt 0 ] ; then 1192 # 1193 # 1194 # 1207 # echo "ERROR IGCM_sys_Get : again demigration error :" 1208 # cat out_rsync 1209 # IGCM_debug_Exit "IGCM_sys_Get" 1195 1210 # fi 1196 1211 # else … … 1205 1220 (( RET=0 )) 1206 1221 for target in ${dm_liste[*]} ; do 1207 local_file=$( basename ${target} ) 1208 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1209 (( RET = RET + $? )) 1222 local_file=$( basename ${target} ) 1223 (( i = 0 )) 1224 # test if the target file is present before the loop 1225 IGCM_sys_TestFileArchive ${target} 1226 RET=$? 1227 if [ ${RET} -gt 0 ] ; then 1228 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1229 IGCM_debug_Exit "IGCM_sys_Get" 1230 else 1231 while [ $i -lt $NB_ESSAI ] ; do 1232 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1233 status=$? 1234 if [ ${status} -gt 0 ]; then 1235 IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}" 1236 IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 1237 sleep $DELAI 1238 else 1239 break 1240 fi 1241 (( i = i + 1 )) 1242 done 1243 (( RET = RET + status )) 1244 fi 1210 1245 done 1211 1246 else … … 1214 1249 fi 1215 1250 1216 # 1217 # 1218 # 1219 1220 # 1221 # 1222 # 1223 1224 # 1225 # 1226 1227 # 1228 # 1251 # #RSYNC WITH NETWORK SSH CALL 1252 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 1253 # ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 1254 1255 # #RSYNC WITH NFS USE 1256 # echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 1257 # ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 1258 1259 # RET=$? 1260 # IGCM_sys_Rsync_out $RET 1261 1262 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1263 # (( RET=RET+$? )) 1229 1264 1230 1265 if [ ${RET} -gt 0 ] ; then … … 1249 1284 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1250 1285 1251 typeset DEST RET buf_liste ifile target file_work 1286 typeset DEST RET buf_liste ifile target file_work 1252 1287 1253 1288 if ( $DEBUG_sys ) ; then … … 1267 1302 (( RET=0 )) 1268 1303 for target in ${buf_liste[*]} ; do 1269 1270 1271 1304 local_file=$( basename ${target} ) 1305 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1306 (( RET = RET + $? )) 1272 1307 done 1273 1308 else … … 1299 1334 echo "IGCM_sys_GetDate_FichWork :" $@ 1300 1335 fi 1301 1336 # donne la date filesys d'un fichier sur la machine work 1302 1337 IGCM_debug_PopStack "IGCM_sys_FichWork" 1303 1338 } … … 1305 1340 #D-#================================================== 1306 1341 #D-function IGCM_sys_GetDate_FichArchive 1307 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1342 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1308 1343 #D-* Examples: 1309 1344 #D- … … 1337 1372 /ccc/cont003/home/dsm/p86maf/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 1338 1373 RET=$? 1339 1374 1340 1375 # if [ ${RET} -gt 0 ] ; then 1341 # 1342 # 1343 # 1376 # echo "IGCM_sys_Dods_Rm : error." 1377 # cat out_dods_rm 1378 # IGCM_debug_Exit "IGCM_sys_Dods_Rm" 1344 1379 # else 1345 # 1380 # rm out_dods_rm 1346 1381 # fi 1347 1382 … … 1363 1398 typeset RET 1364 1399 RET=0 1365 1366 1400 if [ $DRYRUN = 0 ]; then 1367 1401 … … 1375 1409 RET=$? 1376 1410 1377 # 1378 # 1379 # 1380 # 1381 # 1382 # 1383 # 1411 # if [ ${RET} -gt 0 ] ; then 1412 # echo "IGCM_sys_Dods_Cp : error." 1413 # cat out_dods_cp 1414 # IGCM_debug_Exit "IGCM_sys_Dods_Cp" 1415 # else 1416 # rm out_dods_cp 1417 # fi 1384 1418 1385 1419 else … … 1401 1435 typeset RET 1402 1436 if [ $DRYRUN = 0 ]; then 1403 1404 1437 if ( [ ! -d ${R_SAVE}/${1} ] && [ ! -d ${R_FIGR}/${1} ] ) ; then 1405 1438 echo "WARNING IGCM_sys_Put_Dods : None of the following directories exist. Exactly one should." … … 1427 1460 IGCM_sys_Dods_Cp ${1} 1428 1461 RET=0 1429 1462 1430 1463 if [ ${RET} -gt 0 ] ; then 1431 1464 echo "IGCM_sys_Put_Dods : error." … … 1494 1527 IGCM_debug_PushStack "IGCM_sys_check_quota" 1495 1528 if ( $DEBUG_sys ) ; then 1496 1529 echo "IGCM_sys_check_quota" 1497 1530 fi 1498 1531 IGCM_debug_PopStack "IGCM_sys_check_quota" -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh
r669 r676 203 203 (( DEFAULT_NUM_PROC_ATM = BATCH_NUM_PROC_TOT - DEFAULT_NUM_PROC_OCE - DEFAULT_NUM_PROC_CPL )) 204 204 DEFAULT_NUM_PROC_TOTAL=${BATCH_NUM_PROC_TOT} 205 205 206 206 207 #D-#================================================== … … 1016 1017 typeset RET 1017 1018 1018 1019 1020 1021 1022 1019 # Only if we use rsync 1020 #IGCM_sys_TestDirArchive $( dirname $2 ) 1021 # 1022 #USUAL WAY 1023 # add get (to demigrate all offline files) to reduce time of this command : 1023 1024 ccc_hsm get $1/* 1024 1025 \cp -r $1 $2 > out_rsync 2>&1 … … 1225 1226 RET=$? 1226 1227 if [ ${RET} -gt 0 ]; then 1227 1228 1229 1228 IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}" 1229 IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 1230 sleep $DELAI 1230 1231 else 1231 1232 break 1232 1233 fi 1233 1234 (( i = i + 1 )) … … 1398 1399 status=$? 1399 1400 if [ ${status} -gt 0 ]; then 1400 1401 1402 1401 IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}" 1402 IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 1403 sleep $DELAI 1403 1404 else 1404 1405 break 1405 1406 fi 1406 1407 (( i = i + 1 )) … … 2004 2005 IGCM_debug_PopStack "IGCM_sys_check_quota" 2005 2006 } 2006 -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh
r669 r676 1 #!/bin/ksh 1 #!/bin/ksh 2 2 3 3 #************************************************************** … … 14 14 #========================================================= 15 15 # The documentation of this file can be automatically generated 16 # if you use the prefix #D- for comments to be extracted. 16 # if you use the prefix #D- for comments to be extracted. 17 17 # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" 18 18 #========================================================= … … 22 22 #D-#================================================== 23 23 #D- 24 #D- This ksh library if a layer under some usefull 24 #D- This ksh library if a layer under some usefull 25 25 #D-environment variables and shell commands. 26 26 #D-All those definitions depend on host particularities. … … 94 94 95 95 #==================================================== 96 # For interactive jobs on mercure 96 # For interactive jobs on mercure 97 97 PBS_O_WORKDIR=${PBS_O_WORKDIR:=$(pwd)} 98 98 … … 220 220 status=completed 221 221 fi 222 222 223 cat << END_MAIL > job_end.mail 223 224 Dear ${LOGIN}, … … 281 282 fi 282 283 #- creation de repertoire sur le serveur fichier 283 if [ ! -d ${1} ]; then 284 if [ ! -d ${1} ]; then 284 285 \mkdir -p $1 285 286 if [ $? -gt 0 ] ; then … … 302 303 fi 303 304 #- creation de repertoire sur le serveur fichier 304 if [ ! -d ${1} ]; then 305 if [ ! -d ${1} ]; then 305 306 \mkdir -p $1 306 307 if [ $? -gt 0 ] ; then … … 548 549 549 550 #D-************************* 550 #D- File transfer functions 551 #D- File transfer functions 551 552 #D-************************* 552 553 #D- … … 617 618 elif [ $MYLANG = "en" ] ; then 618 619 case $RET in 619 0) return;; 620 0) return;; 620 621 1) echo "rsync error : Syntax or usage error " 621 622 return;; … … 746 747 747 748 typeset RET 748 749 749 750 echo mv $@ > out_rsync 2>&1 750 751 \mv $@ >> out_rsync 2>&1 751 752 RET=$? 752 753 753 754 if [ ${RET} -gt 0 ] ; then 754 755 echo "IGCM_sys_Mv : error in mv." … … 806 807 #D-#================================================== 807 808 #D-function IGCM_sys_Get_Dir 808 #D-* Purpose: Copy a complete directory from $ (ARCHIVE)809 #D-* Purpose: Copy a complete directory from ${ARCHIVE} 809 810 #D-* Examples: 810 811 #D- … … 815 816 fi 816 817 if [ $DRYRUN = 0 ]; then 817 # 818 # 819 # 820 # 821 # 818 # if [ ! -d ${1} ] ; then 819 # echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 820 # IGCM_debug_PopStack "IGCM_sys_Get_Dir" 821 # return 822 # fi 822 823 823 824 typeset RET … … 910 911 RET=$? 911 912 912 # 913 # 914 # 915 916 # 917 # 918 # 919 920 # 921 # 922 923 # 924 # 913 # #RSYNC WITH NETWORK SSH CALL 914 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 915 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 916 917 # #RSYNC WITH NFS USE 918 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 919 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 920 921 # RET=$? 922 # IGCM_sys_Rsync_out $RET 923 924 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 925 # (( RET=RET+$? )) 925 926 926 927 if [ ${RET} -gt 0 ] ; then … … 988 989 echo "IGCM_sys_Put_Out :" $@ 989 990 fi 991 992 typeset NB_ESSAI DELAI RET i exist skip 993 994 # number of tentative 995 NB_ESSAI=3 996 # time delay between tentative 997 DELAI=2 998 990 999 if [ $DRYRUN = 0 ]; then 991 1000 if [ ! -f ${1} ] ; then … … 997 1006 IGCM_sys_MkdirArchive $( dirname $2 ) 998 1007 # 999 typeset RET exist skip1000 1008 1001 1009 #===================================================== … … 1007 1015 # typeset WORKPATH FILEPATH 1008 1016 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" ) 1009 # IGCM_sys_MkdirWork ${WORKPATH} 1017 # IGCM_sys_MkdirWork ${WORKPATH} 1010 1018 # FILEPATH=${WORKPATH}/$( basename $2 ) 1011 1019 # # … … 1015 1023 if [ X${JobType} = XRUN ] ; then 1016 1024 if [ X${3} = X ] ; then 1017 1025 IGCM_sys_Chmod 444 ${1} 1018 1026 fi 1019 1027 fi 1028 # 1020 1029 1021 1030 exist=false … … 1027 1036 exist=true 1028 1037 if [ "X$( diff $1 $2 )" = X ] ; then 1029 1030 1038 IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 1039 skip=true 1031 1040 else 1032 1033 1041 IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 1042 skip=false 1034 1043 fi 1035 1044 fi 1036 # 1045 # 1037 1046 if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 1038 1047 IGCM_sys_Chmod u+w $2 1039 1048 fi 1040 # USUAL WAY 1049 1041 1050 if [ X${skip} = Xfalse ] ; then 1042 \cp $1 $2 > out_rsync 2>&1 1043 RET=$? 1044 if [ ${RET} -gt 0 ] ; then 1045 echo "IGCM_sys_Put_Out : error." 1046 cat out_rsync 1047 IGCM_debug_Exit "IGCM_sys_Put_Out" 1048 else 1049 \rm out_rsync 1050 fi 1051 fi 1052 1053 # #RSYNC WITH NETWORK SSH CALL 1054 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 1055 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 1056 1057 # #RSYNC WITH NFS USE 1058 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 1059 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 1060 1061 # RET=$? 1062 # IGCM_sys_Rsync_out $RET 1063 1064 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1065 # (( RET=RET+$? )) 1066 1051 (( i = 0 )) 1052 while [ $i -lt $NB_ESSAI ] ; do 1053 # USUAL WAY 1054 \cp $1 $2 > out_rsync 2>&1 1055 RET=$? 1056 if [ ${RET} -gt 0 ]; then 1057 IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}" 1058 IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 1059 sleep $DELAI 1060 else 1061 break 1062 fi 1063 (( i = i + 1 )) 1064 done 1065 fi 1066 1067 # #RSYNC WITH NETWORK SSH CALL 1068 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 1069 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 1070 1071 # #RSYNC WITH NFS USE 1072 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 1073 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 1074 1075 # RET=$? 1076 # IGCM_sys_Rsync_out $RET 1077 1078 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1079 # (( RET=RET+$? )) 1080 1081 if [ ${RET} -gt 0 ] ; then 1082 echo "IGCM_sys_Put_Out : error." 1083 cat out_rsync 1084 IGCM_debug_Exit "IGCM_sys_Put_Out" 1085 else 1086 \rm out_rsync 1087 fi 1067 1088 else 1068 1089 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack … … 1095 1116 if [ X${JobType} = XRUN ] ; then 1096 1117 if [ X${3} = X ] ; then 1097 1118 IGCM_sys_Chmod 444 ${1} 1098 1119 fi 1099 1120 fi … … 1125 1146 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1126 1147 1127 typeset DEST RET dm_liste ifile target file_work 1148 typeset DEST RET dm_liste ifile target file_work 1149 typeset NB_ESSAI DELAI status i 1128 1150 1129 1151 if ( $DEBUG_sys ) ; then 1130 1152 echo "IGCM_sys_Get :" $@ 1131 1153 fi 1154 1155 # number of tentative 1156 NB_ESSAI=3 1157 # time delay between tentative 1158 DELAI=2 1159 1132 1160 if [ $DRYRUN -le 2 ]; then 1133 1161 if [ X${1} = X'/l' ] ; then … … 1155 1183 #fi 1156 1184 1157 # test if the (first) file is present in the old computation :1158 IGCM_sys_TestFileArchive ${dm_liste[0]}1159 RET=$?1160 if [ ${RET} -gt 0 ] ; then1161 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."1162 IGCM_debug_Exit "IGCM_sys_Get"1163 fi1164 1165 #dmget ${dm_liste[*]} > out_rsync 2>&11166 1185 ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 1167 1186 RET=$? 1168 1169 1187 if [ ${RET} -gt 0 ] ; then 1170 1188 echo "WARNING IGCM_sys_Get : demigration error." … … 1183 1201 # RET=$? 1184 1202 # if [ ${RET} -gt 0 ] ; then 1185 # 1186 # 1187 # 1203 # echo "ERROR IGCM_sys_Get : again demigration error :" 1204 # cat out_rsync 1205 # IGCM_debug_Exit "IGCM_sys_Get" 1188 1206 # fi 1189 1207 # else … … 1198 1216 (( RET=0 )) 1199 1217 for target in ${dm_liste[*]} ; do 1200 local_file=$( basename ${target} ) 1201 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1202 (( RET = RET + $? )) 1218 local_file=$( basename ${target} ) 1219 (( i = 0 )) 1220 # test if the target file is present before the loop 1221 IGCM_sys_TestFileArchive ${target} 1222 RET=$? 1223 if [ ${RET} -gt 0 ] ; then 1224 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1225 IGCM_debug_Exit "IGCM_sys_Get" 1226 else 1227 while [ $i -lt $NB_ESSAI ] ; do 1228 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1229 status=$? 1230 if [ ${status} -gt 0 ]; then 1231 IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}" 1232 IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 1233 sleep $DELAI 1234 else 1235 break 1236 fi 1237 (( i = i + 1 )) 1238 done 1239 (( RET = RET + status )) 1240 fi 1203 1241 done 1204 1242 else … … 1207 1245 fi 1208 1246 1209 # 1210 # 1211 # 1212 1213 # 1214 # 1215 # 1216 1217 # 1218 # 1219 1220 # 1221 # 1247 # #RSYNC WITH NETWORK SSH CALL 1248 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 1249 # ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 1250 1251 # #RSYNC WITH NFS USE 1252 # echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 1253 # ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 1254 1255 # RET=$? 1256 # IGCM_sys_Rsync_out $RET 1257 1258 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1259 # (( RET=RET+$? )) 1222 1260 1223 1261 if [ ${RET} -gt 0 ] ; then … … 1242 1280 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1243 1281 1244 typeset DEST RET buf_liste ifile target file_work 1282 typeset DEST RET buf_liste ifile target file_work 1245 1283 1246 1284 if ( $DEBUG_sys ) ; then … … 1260 1298 (( RET=0 )) 1261 1299 for target in ${buf_liste[*]} ; do 1262 1263 1264 1300 local_file=$( basename ${target} ) 1301 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1302 (( RET = RET + $? )) 1265 1303 done 1266 1304 else … … 1298 1336 #D-#================================================== 1299 1337 #D-function IGCM_sys_GetDate_FichArchive 1300 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1338 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1301 1339 #D-* Examples: 1302 1340 #D- … … 1311 1349 #D-#================================================== 1312 1350 #D-function IGCM_sys_Dods_Rm 1313 #D-* Purpose: DO NOTHING ! Put $ (ARCHIVE)files on DODS internet protocole.1351 #D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole. 1314 1352 #D-* Examples: 1315 1353 #D- … … 1330 1368 /ccc/cont003/home/dsm/p86ipsl/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 1331 1369 RET=$? 1332 1370 1333 1371 # if [ ${RET} -gt 0 ] ; then 1334 # 1335 # 1336 # 1372 # echo "IGCM_sys_Dods_Rm : error." 1373 # cat out_dods_rm 1374 # IGCM_debug_Exit "IGCM_sys_Dods_Rm" 1337 1375 # else 1338 # 1376 # rm out_dods_rm 1339 1377 # fi 1340 1378 … … 1367 1405 RET=$? 1368 1406 1369 # 1370 # 1371 # 1372 # 1373 # 1374 # 1375 # 1407 # if [ ${RET} -gt 0 ] ; then 1408 # echo "IGCM_sys_Dods_Cp : error." 1409 # cat out_dods_cp 1410 # IGCM_debug_Exit "IGCM_sys_Dods_Cp" 1411 # else 1412 # rm out_dods_cp 1413 # fi 1376 1414 1377 1415 else … … 1418 1456 IGCM_sys_Dods_Cp ${1} 1419 1457 RET=0 1420 1458 1421 1459 if [ ${RET} -gt 0 ] ; then 1422 1460 echo "IGCM_sys_Put_Dods : error." -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh
r669 r676 1211 1211 echo "IGCM_sys_Put_Out :" $@ 1212 1212 fi 1213 1214 typeset NB_ESSAI DELAI RET i 1215 1216 # number of tentative 1217 NB_ESSAI=3 1218 # time delay between tentative 1219 DELAI=2 1220 1213 1221 if [ $DRYRUN = 0 ]; then 1214 1222 if [ ! -f ${1} ] ; then … … 1220 1228 IGCM_sys_MkdirArchive $( dirname $2 ) 1221 1229 # 1222 typeset RET1223 1230 1224 1231 #===================================================== … … 1242 1249 fi 1243 1250 # 1251 1252 (( i = 0 )) 1253 while [ $i -lt $NB_ESSAI ] ; do 1244 1254 # USUAL WAY 1245 \cp $1 $2 > out_rsync 2>&1 1246 RET=$? 1255 \cp $1 $2 > out_rsync 2>&1 1256 RET=$? 1257 if [ ${RET} -gt 0 ]; then 1258 IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}" 1259 IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 1260 sleep $DELAI 1261 else 1262 break 1263 fi 1264 (( i = i + 1 )) 1265 done 1247 1266 1248 1267 # #RSYNC WITH NETWORK SSH CALL … … 1328 1347 1329 1348 typeset DEST RET dm_liste ifile target file_work 1349 typeset NB_ESSAI DELAI status i 1330 1350 1331 1351 if ( $DEBUG_sys ) ; then 1332 1352 echo "IGCM_sys_Get :" $@ 1333 1353 fi 1354 1355 # number of tentative 1356 NB_ESSAI=3 1357 # time delay between tentative 1358 DELAI=2 1359 1334 1360 if [ $DRYRUN -le 2 ]; then 1335 1361 if [ X${1} = X'/l' ] ; then … … 1357 1383 #fi 1358 1384 1359 # test if the (first) file is present in the old computation :1360 IGCM_sys_TestFileArchive ${dm_liste[0]}1361 RET=$?1362 if [ ${RET} -gt 0 ] ; then1363 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."1364 IGCM_debug_Exit "IGCM_sys_Get"1365 fi1366 1367 #dmget ${dm_liste[*]} > out_rsync 2>&11368 1385 ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 1369 1386 RET=$? … … 1400 1417 for target in ${dm_liste[*]} ; do 1401 1418 local_file=$( basename ${target} ) 1402 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1403 (( RET = RET + $? )) 1419 (( i = 0 )) 1420 # test if the target file is present before the loop 1421 IGCM_sys_TestFileArchive ${target} 1422 RET=$? 1423 if [ ${RET} -gt 0 ] ; then 1424 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1425 IGCM_debug_Exit "IGCM_sys_Get" 1426 else 1427 while [ $i -lt $NB_ESSAI ] ; do 1428 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1429 status=$? 1430 if [ ${status} -gt 0 ]; then 1431 IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}" 1432 IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 1433 sleep $DELAI 1434 else 1435 break 1436 fi 1437 (( i = i + 1 )) 1438 done 1439 (( RET = RET + status )) 1440 fi 1404 1441 done 1405 1442 else
Note: See TracChangeset
for help on using the changeset viewer.