Changeset 676 for trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh
- Timestamp:
- 06/05/12 16:31:28 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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."
Note: See TracChangeset
for help on using the changeset viewer.