Changeset 717
- Timestamp:
- 10/12/12 15:00:41 (12 years ago)
- Location:
- trunk/libIGCM/libIGCM_sys
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_sys/libIGCM_sys_default.ksh
r714 r717 522 522 IGCM_debug_Exit "IGCM_sys_Tar" 523 523 fi 524 525 524 IGCM_debug_PopStack "IGCM_sys_Tar" 526 525 } … … 711 710 fi 712 711 713 typeset RET 714 715 echo cp --preserve=timestamps $@ > out_rsync 2>&1 716 \cp --preserve=timestamps $@ >> out_rsync 2>&1 717 RET=$? 718 719 if [ ${RET} -gt 0 ] ; then 720 echo "" 721 # echo "IGCM_sys_Cp : error." 722 # cat out_rsync 723 # IGCM_debug_Exit "IGCM_sys_Cp" 712 typeset status 713 714 echo cp $@ > out_rsync 2>&1 715 \cp $@ >> out_rsync 2>&1 716 status=$? 717 718 if [ ${status} -gt 0 ] ; then 719 echo "IGCM_sys_Cp : error code ${status}" 720 cat out_rsync 721 IGCM_debug_Exit "IGCM_sys_Cp" 724 722 else 725 723 \rm out_rsync … … 739 737 fi 740 738 741 typeset RET739 typeset status 742 740 743 741 echo rm $@ > out_rsync 2>&1 744 742 \rm $@ >> out_rsync 2>&1 745 RET=$?746 747 if [ ${ RET} -gt 0 ] ; then748 echo "IGCM_sys_Rm : error ."743 status=$? 744 745 if [ ${status} -gt 0 ] ; then 746 echo "IGCM_sys_Rm : error code ${status}" 749 747 cat out_rsync 750 748 IGCM_debug_Exit "IGCM_sys_Rm" … … 784 782 if [ $DRYRUN = 0 ]; then 785 783 786 typeset RET784 typeset status 787 785 788 786 echo mv $@ > out_rsync 2>&1 789 787 \mv $@ >> out_rsync 2>&1 790 RET=$?791 792 if [ ${ RET} -gt 0 ] ; then793 echo "IGCM_sys_Mv : error in mv."788 status=$? 789 790 if [ ${status} -gt 0 ] ; then 791 echo "IGCM_sys_Mv : error code ${status}" 794 792 cat out_rsync 795 793 IGCM_debug_Exit "IGCM_sys_Mv" … … 821 819 fi 822 820 823 typeset RET824 825 826 827 828 829 \cp - R$1 $2 > out_rsync 2>&1830 RET=$?831 832 if [ ${ RET} -gt 0 ] ; then833 echo "IGCM_sys_Put_Dir : error ."821 typeset status 822 823 # Only if we use rsync 824 #IGCM_sys_TestDirArchive $( dirname $2 ) 825 # 826 #USUAL WAY 827 \cp -r $1 $2 > out_rsync 2>&1 828 status=$? 829 830 if [ ${status} -gt 0 ] ; then 831 echo "IGCM_sys_Put_Dir : error code ${status}" 834 832 cat out_rsync 835 833 IGCM_debug_Exit "IGCM_sys_Put_Dir" … … 845 843 #D-#================================================== 846 844 #D-function IGCM_sys_Get_Dir 847 #D-* Purpose: Copy a complete directory from $ (ARCHIVE)845 #D-* Purpose: Copy a complete directory from ${ARCHIVE} 848 846 #D-* Examples: 849 847 #D- … … 917 915 #D-#================================================== 918 916 #D-function IGCM_sys_Put_Rest 919 #D-* Purpose: Put computied restarts on $ (ARCHIVE).917 #D-* Purpose: Put computied restarts on ${ARCHIVE}. 920 918 #D- File and target directory must exist. 921 919 #D-* Examples: … … 927 925 fi 928 926 if [ $DRYRUN = 0 ]; then 929 930 IGCM_sys_TestDirArchive $( dirname $2 )931 932 927 if [ ! -f ${1} ] ; then 933 928 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 934 929 IGCM_debug_Exit "IGCM_sys_Put_Rest" 935 930 fi 931 932 typeset status 933 # 936 934 if [ X${JobType} = XRUN ] ; then 937 935 IGCM_sys_Chmod 444 ${1} 938 936 fi 939 937 940 typeset RET 941 942 echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1 943 ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1 944 RET=$? 945 IGCM_sys_Rsync_out $RET 946 947 ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 948 (( RET=RET+$? )) 949 950 if [ ${RET} -gt 0 ] ; then 951 echo "IGCM_sys_Put_Rest : error." 938 # 939 # USUAL WAY 940 \cp $1 $2 > out_rsync 2>&1 941 status=$? 942 943 # #RSYNC WITH NETWORK SSH CALL 944 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 945 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 946 947 # #RSYNC WITH NFS USE 948 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 949 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 950 951 # status=$? 952 # IGCM_sys_Rsync_out $status 953 954 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 955 # (( status=status+$? )) 956 957 if [ ${status} -gt 0 ] ; then 958 echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 952 959 cat out_rsync 953 960 IGCM_debug_Exit "IGCM_sys_Put_Rest" … … 978 985 fi 979 986 980 typeset RET987 typeset status 981 988 # 982 989 if [ X${JobType} = XRUN ] ; then … … 987 994 # USUAL WAY 988 995 \cp $1 $2 > out_rsync 2>&1 989 RET=$?990 991 if [ ${ RET} -gt 0 ] ; then992 echo "IGCM_sys_PutBuffer_Rest : error ."996 status=$? 997 998 if [ ${status} -gt 0 ] ; then 999 echo "IGCM_sys_PutBuffer_Rest : error code ${status}" 993 1000 cat out_rsync 994 1001 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" … … 1004 1011 #D-#================================================== 1005 1012 #D-function IGCM_sys_Put_Out 1006 #D-* Purpose: Copy a file on $ (ARCHIVE) after havechmod it in readonly1013 #D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly 1007 1014 #D-* Examples: 1008 1015 #D- … … 1114 1121 if [ $DRYRUN -le 2 ]; then 1115 1122 if [ X${1} = X'/l' ] ; then 1116 1123 # test if the first file is present in the old computation : 1117 1124 eval set +A dm_liste \${${2}} 1118 1125 else … … 1145 1152 1146 1153 if [ ${RET} -gt 0 ] ; then 1147 echo "IGCM_sys_Get : copy error."1154 echo "IGCM_sys_Get : error" 1148 1155 cat out_rsync 1156 \rm out_rsync 1149 1157 IGCM_debug_Exit "IGCM_sys_Get" 1150 1158 else … … 1165 1173 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1166 1174 1167 typeset DEST RET buf_liste ifile target file_work1175 typeset DEST RET status buf_liste ifile target file_work 1168 1176 1169 1177 if ( $DEBUG_sys ) ; then … … 1189 1197 else 1190 1198 \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 1191 RET=$?1199 status=$? 1192 1200 fi 1193 1201 1194 1202 if [ ${RET} -gt 0 ] ; then 1195 echo "IGCM_sys_GetBuffer : copy error."1203 echo "IGCM_sys_GetBuffer : error" 1196 1204 cat out_rsync 1205 \rm out_rsync 1197 1206 IGCM_debug_Exit "IGCM_sys_GetBuffer" 1198 1207 else … … 1242 1251 #D-#================================================== 1243 1252 #D-function IGCM_sys_Dods_Rm 1244 #D-* Purpose: Suppress files in /tmp/DODS for simulation ofinternet protocole.1253 #D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole. 1245 1254 #D-* Examples: 1246 1255 #D- … … 1298 1307 rebuild -f -o $@ 1299 1308 if [ $? -gt 0 ] ; then 1300 echo "IGCM_sys_rebuild : erreur ${@}."1309 echo "IGCM_sys_rebuild : rebuild error" 1301 1310 IGCM_debug_Exit "rebuild" 1302 1311 fi … … 1700 1709 # NCO OPERATOR 1701 1710 1702 1703 1711 function IGCM_sys_ncap2 { 1704 1712 IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh
r714 r717 111 111 #- IN 112 112 typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM} 113 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/ dmnfs/cont003/p24data}113 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/ccc/work/cont003/dsm/p24data} 114 114 115 115 #==================================================== … … 674 674 fi 675 675 676 typeset RET676 typeset status 677 677 678 678 echo cp $@ > out_rsync 2>&1 679 679 \cp $@ >> out_rsync 2>&1 680 RET=$?681 682 if [ ${ RET} -gt 0 ] ; then683 echo "IGCM_sys_Cp : error ."680 status=$? 681 682 if [ ${status} -gt 0 ] ; then 683 echo "IGCM_sys_Cp : error code ${status}" 684 684 cat out_rsync 685 685 IGCM_debug_Exit "IGCM_sys_Cp" … … 701 701 fi 702 702 703 typeset RET703 typeset status 704 704 705 705 echo rm $@ > out_rsync 2>&1 706 706 \rm $@ >> out_rsync 2>&1 707 RET=$?708 709 if [ ${ RET} -gt 0 ] ; then710 echo "IGCM_sys_Rm : error ."707 status=$? 708 709 if [ ${status} -gt 0 ] ; then 710 echo "IGCM_sys_Rm : error code ${status}" 711 711 cat out_rsync 712 712 IGCM_debug_Exit "IGCM_sys_Rm" … … 746 746 if [ $DRYRUN = 0 ]; then 747 747 748 typeset RET748 typeset status 749 749 750 750 echo mv $@ > out_rsync 2>&1 751 751 \mv $@ >> out_rsync 2>&1 752 RET=$?753 754 if [ ${ RET} -gt 0 ] ; then755 echo "IGCM_sys_Mv : error in mv."752 status=$? 753 754 if [ ${status} -gt 0 ] ; then 755 echo "IGCM_sys_Mv : error code ${status}" 756 756 cat out_rsync 757 757 IGCM_debug_Exit "IGCM_sys_Mv" … … 783 783 fi 784 784 785 typeset RET785 typeset status 786 786 787 787 # Only if we use rsync … … 790 790 #USUAL WAY 791 791 \cp -r $1 $2 > out_rsync 2>&1 792 RET=$?793 794 if [ ${ RET} -gt 0 ] ; then795 echo "IGCM_sys_Put_Dir : error ."792 status=$? 793 794 if [ ${status} -gt 0 ] ; then 795 echo "IGCM_sys_Put_Dir : error code ${status}" 796 796 cat out_rsync 797 797 IGCM_debug_Exit "IGCM_sys_Put_Dir" … … 822 822 # fi 823 823 824 typeset RET 824 typeset NB_ESSAI DELAI status i 825 # number of tentative 826 NB_ESSAI=3 827 # time delay between tentative 828 DELAI=2 825 829 826 830 # Only if we use rsync 827 831 #IGCM_sys_TestDirArchive $( dirname $2 ) 828 832 # 829 #USUAL WAY 830 # add dmget (to demigrate all offline files) to reduce time of this command : 831 #dmget $1/* 833 # USUAL WAY 834 # add 'ccc_hsm get' (to demigrate all offline files) to reduce time of this command : 832 835 ccc_hsm get -r $1 833 \cp -r $1 $2 > out_rsync 2>&1 834 RET=$? 835 836 if [ ${RET} -gt 0 ] ; then 836 837 i=0 838 while [ $i -lt $NB_ESSAI ] ; do 839 \cp -ur $1 $2 >> out_rsync 2>&1 840 status=$? 841 if [ ${status} -gt 0 ]; then 842 IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status} ${i}/${NB_ESSAI}" 843 IGCM_debug_Print 2 "IGCM_sys_Get_Dir : sleep ${DELAI} seconds and try again." 844 sleep $DELAI 845 else 846 break 847 fi 848 (( i = i + 1 )) 849 done 850 851 if [ ${status} -gt 0 ] ; then 837 852 echo "IGCM_sys_Get_Dir : error." 838 853 cat out_rsync … … 864 879 fi 865 880 866 typeset RET 867 868 #USUAL WAY 869 \cp -rL $1 $2 > out_rsync 2>&1 870 RET=$? 871 872 if [ ${RET} -gt 0 ] ; then 881 typeset NB_ESSAI DELAI status i 882 # number of tentative 883 NB_ESSAI=3 884 # time delay between tentative 885 DELAI=2 886 887 i=0 888 while [ $i -lt $NB_ESSAI ] ; do 889 \cp -urL $1 $2 > out_rsync 2>&1 890 status=$? 891 if [ ${status} -gt 0 ]; then 892 IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}" 893 IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." 894 sleep $DELAI 895 else 896 break 897 fi 898 (( i = i + 1 )) 899 done 900 901 if [ ${status} -gt 0 ] ; then 873 902 echo "IGCM_sys_Get_Master : error." 874 903 cat out_rsync … … 900 929 fi 901 930 902 typeset RET931 typeset status 903 932 # 904 933 if [ X${JobType} = XRUN ] ; then … … 909 938 # USUAL WAY 910 939 \cp $1 $2 > out_rsync 2>&1 911 RET=$?940 status=$? 912 941 913 942 # #RSYNC WITH NETWORK SSH CALL … … 919 948 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 920 949 921 # RET=$?922 # IGCM_sys_Rsync_out $ RET950 # status=$? 951 # IGCM_sys_Rsync_out $status 923 952 924 953 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 925 # (( RET=RET+$? ))926 927 if [ ${ RET} -gt 0 ] ; then928 echo "IGCM_sys_Put_Rest : error."954 # (( status=status+$? )) 955 956 if [ ${status} -gt 0 ] ; then 957 echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 929 958 cat out_rsync 930 959 IGCM_debug_Exit "IGCM_sys_Put_Rest" … … 955 984 fi 956 985 957 typeset RET986 typeset status 958 987 # 959 988 if [ X${JobType} = XRUN ] ; then … … 964 993 # USUAL WAY 965 994 \cp $1 $2 > out_rsync 2>&1 966 RET=$?967 968 if [ ${ RET} -gt 0 ] ; then969 echo "IGCM_sys_PutBuffer_Rest : error ."995 status=$? 996 997 if [ ${status} -gt 0 ] ; then 998 echo "IGCM_sys_PutBuffer_Rest : error code ${status}" 970 999 cat out_rsync 971 1000 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" … … 1055 1084 status=$? 1056 1085 if [ ${status} -gt 0 ]; then 1057 IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}"1086 IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 1058 1087 IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 1059 1088 sleep $DELAI … … 1153 1182 status=$? 1154 1183 if [ ${status} -gt 0 ]; then 1155 IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed ${i}/${NB_ESSAI}"1184 IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 1156 1185 IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again." 1157 1186 sleep $DELAI … … 1223 1252 1224 1253 ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 1225 RET=$?1226 if [ ${ RET} -gt 0 ] ; then1227 echo "WARNING IGCM_sys_Get : demigration error."1254 status=$? 1255 if [ ${status} -gt 0 ] ; then 1256 echo "WARNING IGCM_sys_Get : error code ${status}" 1228 1257 cat out_rsync 1229 1258 echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 1230 1259 fi 1231 1260 1232 #if [ ${ RET} -gt 0 ] ; then1261 #if [ ${status} -gt 0 ] ; then 1233 1262 # if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 1234 1263 # cat out_rsync … … 1238 1267 ## dmget ${dm_liste[*]} > out_rsync 2>&1 1239 1268 # ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 1240 # RET=$?1241 # if [ ${ RET} -gt 0 ] ; then1269 # status=$? 1270 # if [ ${status} -gt 0 ] ; then 1242 1271 # echo "ERROR IGCM_sys_Get : again demigration error :" 1243 1272 # cat out_rsync … … 1259 1288 # test if the target file is present before the loop 1260 1289 IGCM_sys_TestFileArchive ${target} 1261 RET=$?1262 if [ ${ RET} -gt 0 ] ; then1290 status=$? 1291 if [ ${status} -gt 0 ] ; then 1263 1292 echo "IGCM_sys_Get, ERROR : regular file ${target} DOES NOT EXIST ." 1264 1293 IGCM_debug_Exit "IGCM_sys_Get" … … 1268 1297 status=$? 1269 1298 if [ ${status} -gt 0 ]; then 1270 IGCM_debug_Print 2 "IGCM_sys_Get : cp failed ${i}/${NB_ESSAI}"1299 IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status} ${i}/${NB_ESSAI}" 1271 1300 IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 1272 1301 sleep $DELAI … … 1281 1310 else 1282 1311 \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 1283 RET=$?1312 status=$? 1284 1313 fi 1285 1314 … … 1292 1321 # ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 1293 1322 1294 # RET=$?1295 # IGCM_sys_Rsync_out $ RET1323 # status=$? 1324 # IGCM_sys_Rsync_out $status 1296 1325 1297 1326 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync … … 1299 1328 1300 1329 if [ ${RET} -gt 0 ] ; then 1301 echo "IGCM_sys_Get : copy error."1330 echo "IGCM_sys_Get : error" 1302 1331 cat out_rsync 1303 1332 # IGCM_debug_Exit "IGCM_sys_Get" … … 1319 1348 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1320 1349 1321 typeset DEST RET buf_liste ifile target file_work1350 typeset DEST RET status buf_liste ifile target file_work 1322 1351 1323 1352 if ( $DEBUG_sys ) ; then … … 1343 1372 else 1344 1373 \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 1345 RET=$?1374 status=$? 1346 1375 fi 1347 1376 1348 1377 if [ ${RET} -gt 0 ] ; then 1349 echo "IGCM_sys_GetBuffer : copy error." 1350 cat out_rsync 1378 echo "IGCM_sys_GetBuffer : error" 1379 cat out_rsync 1380 \rm out_rsync 1351 1381 IGCM_debug_Exit "IGCM_sys_GetBuffer" 1352 1382 else … … 1395 1425 echo "IGCM_sys_Dods_Rm :" $@ 1396 1426 fi 1397 typeset RET 1398 RET=0 1427 typeset status 1399 1428 if [ $DRYRUN = 0 ]; then 1400 1429 … … 1406 1435 1407 1436 /ccc/cont003/home/dsm/p86ipsl/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 1408 RET=$?1409 1410 # if [ ${ RET} -gt 0 ] ; then1437 status=$? 1438 1439 # if [ ${status} -gt 0 ] ; then 1411 1440 # echo "IGCM_sys_Dods_Rm : error." 1412 1441 # cat out_dods_rm … … 1419 1448 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1420 1449 fi 1421 return $ RET1450 return $status 1422 1451 } 1423 1452 … … 1431 1460 echo "IGCM_sys_Dods_Cp :" $@ 1432 1461 fi 1433 typeset RET 1434 RET=0 1462 typeset status 1435 1463 if [ $DRYRUN = 0 ]; then 1436 1464 … … 1442 1470 1443 1471 /ccc/cont003/home/dsm/p86ipsl/bin/dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1 1444 RET=$?1445 1446 # if [ ${ RET} -gt 0 ] ; then1472 status=$? 1473 1474 # if [ ${status} -gt 0 ] ; then 1447 1475 # echo "IGCM_sys_Dods_Cp : error." 1448 1476 # cat out_dods_cp … … 1455 1483 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1456 1484 fi 1457 return $ RET1485 return $status 1458 1486 } 1459 1487 … … 1468 1496 echo "IGCM_sys_Put_Dods :" $@ 1469 1497 fi 1470 typeset RET 1498 #set -vx 1499 typeset status 1471 1500 if [ $DRYRUN = 0 ]; then 1472 1501 if ( [ ! -d ${R_SAVE}/${1} ] && [ ! -d ${R_FIGR}/${1} ] ) ; then … … 1494 1523 IGCM_sys_Dods_Rm ${1} 1495 1524 IGCM_sys_Dods_Cp ${1} 1496 RET=01497 1498 if [ ${ RET} -gt 0 ] ; then1525 status=0 1526 1527 if [ ${status} -gt 0 ] ; then 1499 1528 echo "IGCM_sys_Put_Dods : error." 1500 1529 IGCM_debug_Exit "IGCM_sys_Put_Dods" … … 1514 1543 echo "IGCM_sys_rebuild :" $@ 1515 1544 fi 1516 /home/cont003/p86ipsl/X86_64/bin/rebuild -f -o $@ 1545 1546 typeset NB_ESSAI DELAI status i 1547 # number of tentative 1548 NB_ESSAI=3 1549 # time delay between tentative 1550 DELAI=2 1551 1552 i=0 1553 while [ $i -lt $NB_ESSAI ] ; do 1554 /home/cont003/p86ipsl/X86_64/bin/rebuild -f -o $@ > out_rsync 2>&1 1555 status=$? 1556 if [ ${status} -gt 0 ] ; then 1557 IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" 1558 cat out_rsync 1559 \rm out_rsync 1560 IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 1561 else 1562 \rm out_rsync 1563 break 1564 fi 1565 (( i = i + 1 )) 1566 done 1567 1517 1568 if [ $? -gt 0 ] ; then 1518 echo "IGCM_sys_rebuild : erreur ${@}."1569 echo "IGCM_sys_rebuild : rebuild error" 1519 1570 IGCM_debug_Exit "rebuild" 1520 1571 fi -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex9.ksh
r705 r717 112 112 113 113 #==================================================== 114 #- MirrorlibIGCM uncommentfor frontend114 #- MirrorlibIGCM for frontend 115 115 typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} 116 116 117 117 #==================================================== 118 #- libIGCM_POST uncommentfor frontend118 #- libIGCM_POST for frontend 119 119 typeset -r libIGCM_POST=${libIGCM} 120 120 … … 137 137 #- IN 138 138 typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM} 139 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/ dmnfs/cont003/p24data}139 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/ccc/work/cont003/dsm/p24data} 140 140 141 141 #==================================================== … … 245 245 IGCM_debug_Exit "IGCM_sys_RshPost" 246 246 fi 247 # delete temporary file 247 248 \rm tmp_IGCM_sys_RshPost_$$ 248 249 … … 291 292 status=completed 292 293 fi 294 293 295 cat << END_MAIL > job_end.mail 294 296 Dear ${LOGIN}, 295 297 296 298 Simulation ${config_UserChoices_JobName} is ${status} on supercomputer `hostname`. … … 354 356 fi 355 357 #- creation de repertoire sur le serveur fichier 356 if [ ! -d ${1} ]; then 358 if [ ! -d ${1} ]; then 357 359 \mkdir -p $1 358 360 if [ $? -gt 0 ] ; then … … 375 377 fi 376 378 #- creation de repertoire sur le serveur fichier 377 if [ ! -d ${1} ]; then 379 if [ ! -d ${1} ]; then 378 380 \mkdir -p $1 379 381 if [ $? -gt 0 ] ; then … … 664 666 665 667 #D-************************* 666 #D- File transfer functions 668 #D- File transfer functions 667 669 #D-************************* 668 670 #D- … … 733 735 elif [ $MYLANG = "en" ] ; then 734 736 case $RET in 735 0) return;; 737 0) return;; 736 738 1) echo "rsync error : Syntax or usage error " 737 739 return;; … … 789 791 fi 790 792 791 typeset RETDEST793 typeset status DEST 792 794 793 795 mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} … … 795 797 echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 796 798 ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 797 RET=$?798 799 if [ ${ RET} -gt 0 ] ; then799 status=$? 800 801 if [ ${status} -gt 0 ] ; then 800 802 echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium." 801 803 cat out_rsync … … 815 817 fi 816 818 817 typeset RET819 typeset status 818 820 819 821 echo cp $@ > out_rsync 2>&1 820 822 \cp $@ >> out_rsync 2>&1 821 RET=$?822 823 if [ ${ RET} -gt 0 ] ; then824 echo "IGCM_sys_Cp : error ."823 status=$? 824 825 if [ ${status} -gt 0 ] ; then 826 echo "IGCM_sys_Cp : error code ${status}" 825 827 cat out_rsync 826 828 IGCM_debug_Exit "IGCM_sys_Cp" … … 842 844 fi 843 845 844 typeset RET846 typeset status 845 847 846 848 echo rm $@ > out_rsync 2>&1 847 849 \rm $@ >> out_rsync 2>&1 848 RET=$?849 850 if [ ${ RET} -gt 0 ] ; then851 echo "IGCM_sys_Rm : error ."850 status=$? 851 852 if [ ${status} -gt 0 ] ; then 853 echo "IGCM_sys_Rm : error code ${status}" 852 854 cat out_rsync 853 855 IGCM_debug_Exit "IGCM_sys_Rm" … … 871 873 if [ $DRYRUN = 0 ]; then 872 874 873 typeset RET874 875 typeset status 876 875 877 echo mv $@ > out_rsync 2>&1 876 878 \mv $@ >> out_rsync 2>&1 877 RET=$?878 879 if [ ${ RET} -gt 0 ] ; then880 echo "IGCM_sys_Mv : error in mv."879 status=$? 880 881 if [ ${status} -gt 0 ] ; then 882 echo "IGCM_sys_Mv : error code ${status}" 881 883 cat out_rsync 882 884 IGCM_debug_Exit "IGCM_sys_Mv" … … 908 910 fi 909 911 910 typeset RET912 typeset status 911 913 912 914 # Only if we use rsync … … 915 917 #USUAL WAY 916 918 \cp -r $1 $2 > out_rsync 2>&1 917 RET=$?918 919 if [ ${ RET} -gt 0 ] ; then920 echo "IGCM_sys_Put_Dir : error ."919 status=$? 920 921 if [ ${status} -gt 0 ] ; then 922 echo "IGCM_sys_Put_Dir : error code ${status}" 921 923 cat out_rsync 922 924 IGCM_debug_Exit "IGCM_sys_Put_Dir" … … 947 949 # fi 948 950 949 typeset RET 951 typeset NB_ESSAI DELAI status i 952 # number of tentative 953 NB_ESSAI=3 954 # time delay between tentative 955 DELAI=2 950 956 951 957 # Only if we use rsync … … 953 959 # 954 960 # USUAL WAY 955 # add dmfind/dmget (to demigrate all offline files) : 956 #dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget 957 \cp -r $1 $2 > out_rsync 2>&1 958 RET=$? 959 960 if [ ${RET} -gt 0 ] ; then 961 # add 'ccc_hsm get' (to demigrate all offline files) to reduce time of this command : 962 ccc_hsm get -r $1 963 964 i=0 965 while [ $i -lt $NB_ESSAI ] ; do 966 \cp -ur $1 $2 >> out_rsync 2>&1 967 status=$? 968 if [ ${status} -gt 0 ]; then 969 IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status} ${i}/${NB_ESSAI}" 970 IGCM_debug_Print 2 "IGCM_sys_Get_Dir : sleep ${DELAI} seconds and try again." 971 sleep $DELAI 972 else 973 break 974 fi 975 (( i = i + 1 )) 976 done 977 978 if [ ${status} -gt 0 ] ; then 961 979 echo "IGCM_sys_Get_Dir : error." 962 980 cat out_rsync … … 994 1012 fi 995 1013 996 typeset RET1014 typeset status 997 1015 # 998 1016 if [ X${JobType} = XRUN ] ; then … … 1003 1021 # USUAL WAY 1004 1022 \cp $1 $2 > out_rsync 2>&1 1005 RET=$?1006 1007 # 1008 # 1009 # 1010 1011 # 1012 # 1013 # 1014 1015 # RET=$?1016 # IGCM_sys_Rsync_out $RET1017 1018 # 1019 # (( RET=RET+$? ))1020 1021 if [ ${ RET} -gt 0 ] ; then1022 echo "IGCM_sys_Put_Rest : error."1023 status=$? 1024 1025 # #RSYNC WITH NETWORK SSH CALL 1026 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 1027 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 1028 1029 # #RSYNC WITH NFS USE 1030 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 1031 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 1032 1033 # status=$? 1034 # IGCM_sys_Rsync_out $status 1035 1036 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1037 # (( status=status+$? )) 1038 1039 if [ ${status} -gt 0 ] ; then 1040 echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 1023 1041 cat out_rsync 1024 1042 IGCM_debug_Exit "IGCM_sys_Put_Rest" … … 1049 1067 fi 1050 1068 1051 typeset RET1069 typeset status 1052 1070 # 1053 1071 if [ X${JobType} = XRUN ] ; then … … 1058 1076 # USUAL WAY 1059 1077 \cp $1 $2 > out_rsync 2>&1 1060 RET=$?1061 1062 if [ ${ RET} -gt 0 ] ; then1063 echo "IGCM_sys_PutBuffer_Rest : error ."1078 status=$? 1079 1080 if [ ${status} -gt 0 ] ; then 1081 echo "IGCM_sys_PutBuffer_Rest : error code ${status}" 1064 1082 cat out_rsync 1065 1083 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" … … 1083 1101 echo "IGCM_sys_Put_Out :" $@ 1084 1102 fi 1103 1104 typeset NB_ESSAI DELAI status i exist skip 1105 1106 # number of tentative 1107 NB_ESSAI=3 1108 # time delay between tentative 1109 DELAI=2 1110 1085 1111 if [ $DRYRUN = 0 ]; then 1086 1112 if [ ! -f ${1} ] ; then … … 1092 1118 IGCM_sys_MkdirArchive $( dirname $2 ) 1093 1119 # 1094 typeset RET1095 1120 1096 1121 #===================================================== … … 1102 1127 # typeset WORKPATH FILEPATH 1103 1128 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" ) 1104 # IGCM_sys_MkdirWork ${WORKPATH} 1129 # IGCM_sys_MkdirWork ${WORKPATH} 1105 1130 # FILEPATH=${WORKPATH}/$( basename $2 ) 1106 1131 # # … … 1110 1135 if [ X${JobType} = XRUN ] ; then 1111 1136 if [ X${3} = X ] ; then 1112 1137 IGCM_sys_Chmod 444 ${1} 1113 1138 fi 1114 1139 fi 1115 1140 # 1116 # USUAL WAY 1117 \cp $1 $2 > out_rsync 2>&1 1118 RET=$? 1119 1120 # #RSYNC WITH NETWORK SSH CALL 1121 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 1122 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 1123 1124 # #RSYNC WITH NFS USE 1125 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 1126 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 1127 1128 # RET=$? 1129 # IGCM_sys_Rsync_out $RET 1130 1131 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1132 # (( RET=RET+$? )) 1133 1134 if [ ${RET} -gt 0 ] ; then 1141 1142 exist=false 1143 skip=false 1144 if [ -f $2 ] ; then 1145 IGCM_debug_Print 1 "$2 already exist" 1146 #dmget $2 1147 ccc_hsm get $2 1148 exist=true 1149 if [ "X$( diff $1 $2 )" = X ] ; then 1150 IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 1151 skip=true 1152 else 1153 IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 1154 skip=false 1155 fi 1156 fi 1157 # 1158 if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 1159 IGCM_sys_Chmod u+w $2 1160 fi 1161 1162 if [ X${skip} = Xfalse ] ; then 1163 (( i = 0 )) 1164 while [ $i -lt $NB_ESSAI ] ; do 1165 # USUAL WAY 1166 \cp $1 $2 > out_rsync 2>&1 1167 status=$? 1168 if [ ${status} -gt 0 ]; then 1169 IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 1170 IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 1171 sleep $DELAI 1172 else 1173 break 1174 fi 1175 (( i = i + 1 )) 1176 done 1177 fi 1178 1179 # #RSYNC WITH NETWORK SSH CALL 1180 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 1181 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 1182 1183 # #RSYNC WITH NFS USE 1184 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 1185 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 1186 1187 # status=$? 1188 # IGCM_sys_Rsync_out $status 1189 1190 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1191 # (( status=status+$? )) 1192 1193 if [ ${status} -gt 0 ] ; then 1135 1194 echo "IGCM_sys_Put_Out : error." 1136 1195 cat out_rsync … … 1156 1215 echo "IGCM_sys_PutBuffer_Out :" $@ 1157 1216 fi 1217 1218 typeset NB_ESSAI DELAI status i exist skip 1219 1220 # number of tentative 1221 NB_ESSAI=3 1222 # time delay between tentative 1223 DELAI=2 1224 1158 1225 if [ $DRYRUN = 0 ]; then 1159 1226 if [ ! -f ${1} ] ; then … … 1165 1232 IGCM_sys_Mkdir $( dirname $2 ) 1166 1233 # 1167 typeset RET1168 1234 1169 1235 if [ X${JobType} = XRUN ] ; then 1170 1236 if [ X${3} = X ] ; then 1171 1237 IGCM_sys_Chmod 444 ${1} 1172 1238 fi 1173 1239 fi 1240 1241 exist=false 1242 skip=false 1243 if [ -f $2 ] ; then 1244 IGCM_debug_Print 1 "$2 already exist" 1245 exist=true 1246 if [ "X$( diff $1 $2 )" = X ] ; then 1247 IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 1248 skip=true 1249 else 1250 IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 1251 skip=false 1252 fi 1253 fi 1174 1254 # 1175 # USUAL WAY 1176 \cp $1 $2 > out_rsync 2>&1 1177 RET=$? 1178 1179 if [ ${RET} -gt 0 ] ; then 1255 if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 1256 IGCM_sys_Chmod u+w $2 1257 fi 1258 1259 if [ X${skip} = Xfalse ] ; then 1260 i=0 1261 while [ $i -lt $NB_ESSAI ] ; do 1262 # USUAL WAY 1263 \cp $1 $2 > out_rsync 2>&1 1264 status=$? 1265 if [ ${status} -gt 0 ]; then 1266 IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 1267 IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again." 1268 sleep $DELAI 1269 else 1270 break 1271 fi 1272 (( i = i + 1 )) 1273 done 1274 fi 1275 1276 if [ ${status} -gt 0 ] ; then 1180 1277 echo "IGCM_sys_PutBuffer_Out : error." 1181 1278 cat out_rsync … … 1199 1296 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1200 1297 1201 typeset DEST RET dm_liste ifile target file_work 1298 typeset DEST RET dm_liste ifile target file_work 1299 typeset NB_ESSAI DELAI status i 1202 1300 1203 1301 if ( $DEBUG_sys ) ; then 1204 1302 echo "IGCM_sys_Get :" $@ 1205 1303 fi 1304 1305 # number of tentative 1306 NB_ESSAI=3 1307 # time delay between tentative 1308 DELAI=2 1309 1206 1310 if [ $DRYRUN -le 2 ]; then 1207 1311 if [ X${1} = X'/l' ] ; then … … 1229 1333 #fi 1230 1334 1231 # test if the (first) file is present in the old computation :1232 IGCM_sys_TestFileArchive ${dm_liste[0]}1233 RET=$?1234 if [ ${RET} -gt 0 ] ; then1235 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."1236 IGCM_debug_Exit "IGCM_sys_Get"1237 fi1238 1239 #dmget ${dm_liste[*]} > out_rsync 2>&11240 1335 ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 1241 RET=$?1242 if [ ${ RET} -gt 0 ] ; then1243 echo "WARNING IGCM_sys_Get : demigration error."1336 status=$? 1337 if [ ${status} -gt 0 ] ; then 1338 echo "WARNING IGCM_sys_Get : error code ${status}" 1244 1339 cat out_rsync 1245 1340 echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 1246 1341 fi 1247 1342 1248 #if [ ${ RET} -gt 0 ] ; then1343 #if [ ${status} -gt 0 ] ; then 1249 1344 # if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 1250 1345 # cat out_rsync … … 1254 1349 ## dmget ${dm_liste[*]} > out_rsync 2>&1 1255 1350 # ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 1256 # RET=$?1257 # if [ ${ RET} -gt 0 ] ; then1258 # 1259 # 1260 # 1351 # status=$? 1352 # if [ ${status} -gt 0 ] ; then 1353 # echo "ERROR IGCM_sys_Get : again demigration error :" 1354 # cat out_rsync 1355 # IGCM_debug_Exit "IGCM_sys_Get" 1261 1356 # fi 1262 1357 # else … … 1271 1366 (( RET=0 )) 1272 1367 for target in ${dm_liste[*]} ; do 1273 local_file=$( basename ${target} ) 1274 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1275 (( RET = RET + $? )) 1368 local_file=$( basename ${target} ) 1369 (( i = 0 )) 1370 # test if the target file is present before the loop 1371 IGCM_sys_TestFileArchive ${target} 1372 status=$? 1373 if [ ${status} -gt 0 ] ; then 1374 echo "IGCM_sys_Get, ERROR : regular file ${target} DOES NOT EXIST ." 1375 IGCM_debug_Exit "IGCM_sys_Get" 1376 else 1377 while [ $i -lt $NB_ESSAI ] ; do 1378 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1379 status=$? 1380 if [ ${status} -gt 0 ]; then 1381 IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status} ${i}/${NB_ESSAI}" 1382 IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 1383 sleep $DELAI 1384 else 1385 break 1386 fi 1387 (( i = i + 1 )) 1388 done 1389 (( RET = RET + status )) 1390 fi 1276 1391 done 1277 1392 else 1278 1393 \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 1279 RET=$?1280 fi 1281 1282 # 1283 # 1284 # 1285 1286 # 1287 # 1288 # 1289 1290 # RET=$?1291 # IGCM_sys_Rsync_out $RET1292 1293 # 1294 # 1394 status=$? 1395 fi 1396 1397 # #RSYNC WITH NETWORK SSH CALL 1398 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 1399 # ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 1400 1401 # #RSYNC WITH NFS USE 1402 # echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 1403 # ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 1404 1405 # status=$? 1406 # IGCM_sys_Rsync_out $status 1407 1408 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1409 # (( RET=RET+$? )) 1295 1410 1296 1411 if [ ${RET} -gt 0 ] ; then 1297 echo "IGCM_sys_Get : copy error."1412 echo "IGCM_sys_Get : error" 1298 1413 cat out_rsync 1414 \rm out_rsync 1299 1415 IGCM_debug_Exit "IGCM_sys_Get" 1300 1416 else … … 1315 1431 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1316 1432 1317 typeset DEST RET buf_liste ifile target file_work1433 typeset DEST RET status buf_liste ifile target file_work 1318 1434 1319 1435 if ( $DEBUG_sys ) ; then … … 1333 1449 (( RET=0 )) 1334 1450 for target in ${buf_liste[*]} ; do 1335 1336 1337 1451 local_file=$( basename ${target} ) 1452 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1453 (( RET = RET + $? )) 1338 1454 done 1339 1455 else 1340 1456 \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 1341 RET=$?1457 status=$? 1342 1458 fi 1343 1459 1344 1460 if [ ${RET} -gt 0 ] ; then 1345 echo "IGCM_sys_GetBuffer : copy error."1461 echo "IGCM_sys_GetBuffer : error" 1346 1462 cat out_rsync 1463 \rm out_rsync 1347 1464 IGCM_debug_Exit "IGCM_sys_GetBuffer" 1348 1465 else … … 1375 1492 #D-#================================================== 1376 1493 #D-function IGCM_sys_GetDate_FichArchive 1377 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1494 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1378 1495 #D-* Examples: 1379 1496 #D- … … 1398 1515 echo "IGCM_sys_rebuild :" $@ 1399 1516 fi 1400 /home/cont003/p86ipsl/SX8/bin/rebuild -f -o $@ 1517 1518 typeset NB_ESSAI DELAI status i 1519 # number of tentative 1520 NB_ESSAI=3 1521 # time delay between tentative 1522 DELAI=2 1523 1524 i=0 1525 while [ $i -lt $NB_ESSAI ] ; do 1526 /home/cont003/p86ipsl/SX8/bin/rebuild -f -o $@ > out_rsync 2>&1 1527 status=$? 1528 if [ ${status} -gt 0 ] ; then 1529 IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" 1530 cat out_rsync 1531 \rm out_rsync 1532 IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 1533 else 1534 \rm out_rsync 1535 break 1536 fi 1537 (( i = i + 1 )) 1538 done 1539 1401 1540 if [ $? -gt 0 ] ; then 1402 echo "IGCM_sys_rebuild : erreur ${@}."1541 echo "IGCM_sys_rebuild : rebuild error" 1403 1542 IGCM_debug_Exit "rebuild" 1404 1543 fi … … 1567 1706 ############################################################ 1568 1707 # Build MPI/OMP scripts 1569 function IGCM_sys_build_execution_scripts 1708 function IGCM_sys_build_execution_scripts 1570 1709 { 1571 1710 IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_obelix.ksh
r714 r717 64 64 # Host and user names 65 65 # $hostname ou hostname 66 # $hostname ou hostname67 66 typeset HOST=${HOST:=$( hostname )} 68 67 # $username ou whoami … … 141 140 142 141 #==================================================== 143 #- OUT142 #- R_OUT 144 143 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT 145 144 … … 268 267 status=completed 269 268 fi 269 270 270 cat << END_MAIL > job_end.mail 271 271 Dear ${LOGIN}, … … 308 308 fi 309 309 fi 310 310 # vérification : 311 311 if [ ! -d ${1} ] ; then 312 312 echo "IGCM_sys_Mkdir : erreur." … … 326 326 echo "IGCM_sys_MkdirArchive :" $@ 327 327 fi 328 328 #- creation de repertoire sur le serveur fichier 329 329 if [ ! -d ${1} ]; then 330 330 \mkdir -p $1 … … 347 347 echo "IGCM_sys_MkdirWork :" $@ 348 348 fi 349 349 #- creation de repertoire sur le serveur fichier 350 350 if [ ! -d ${1} ]; then 351 351 \mkdir -p $1 … … 537 537 IGCM_debug_Exit "IGCM_sys_Tar" 538 538 fi 539 540 539 IGCM_debug_PopStack "IGCM_sys_Tar" 541 540 } … … 607 606 #D- Error values and explanations can depend on your system version. 608 607 function IGCM_sys_Rsync_out { 609 RET=$1610 if [ ! $ RET] ; then608 status=$1 609 if [ ! $status ] ; then 611 610 echo "rsync error !" 612 611 fi 613 612 614 613 if [ $MYLANG = "fr" ]; then 615 case $ RETin614 case $status in 616 615 0) return ;; 617 616 1) echo "Erreur de rsync ; RERR_SYNTAX : " … … 661 660 echo "Temps d'attente écoulé dans l'envoi/réception de données" 662 661 return;; 663 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $ RET662 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $status 664 663 return;; 665 664 esac 666 665 elif [ $MYLANG = "en" ] ; then 667 case $ RETin666 case $status in 668 667 0) return;; 669 668 1) echo "rsync error : Syntax or usage error " … … 702 701 30) echo "rsync error : Timeout in data send/receive " 703 702 return;; 704 *) echo "rsync error : return code of rsync unknown :" $ RET703 *) echo "rsync error : return code of rsync unknown :" $status 705 704 return;; 706 705 esac … … 722 721 fi 723 722 724 typeset RET725 726 echo cp --preserve=timestamps$@ > out_rsync 2>&1727 \cp --preserve=timestamps$@ >> out_rsync 2>&1728 RET=$?729 730 if [ ${ RET} -gt 0 ] ; then731 echo "IGCM_sys_Cp : error ."723 typeset status 724 725 echo cp $@ > out_rsync 2>&1 726 \cp $@ >> out_rsync 2>&1 727 status=$? 728 729 if [ ${status} -gt 0 ] ; then 730 echo "IGCM_sys_Cp : error code ${status}" 732 731 cat out_rsync 733 732 IGCM_debug_Exit "IGCM_sys_Cp" 734 733 else 735 rm out_rsync734 \rm out_rsync 736 735 fi 737 736 IGCM_debug_PopStack "IGCM_sys_Cp" … … 749 748 fi 750 749 751 typeset RET750 typeset status 752 751 753 752 echo rm $@ > out_rsync 2>&1 754 753 \rm $@ >> out_rsync 2>&1 755 RET=$?756 757 if [ ${ RET} -gt 0 ] ; then758 echo "IGCM_sys_Rm : error ."754 status=$? 755 756 if [ ${status} -gt 0 ] ; then 757 echo "IGCM_sys_Rm : error code ${status}" 759 758 cat out_rsync 760 759 IGCM_debug_Exit "IGCM_sys_Rm" 761 760 else 762 rm out_rsync761 \rm out_rsync 763 762 fi 764 763 IGCM_debug_PopStack "IGCM_sys_Rm" … … 777 776 fi 778 777 779 typeset RET778 typeset status 780 779 781 780 echo rm $@ > out_rsync 2>&1 782 781 \rm $@ >> out_rsync 2>&1 783 RET=$?784 785 if [ ${ RET} -gt 0 ] ; then786 echo "IGCM_sys_RmRunDir : error ."782 status=$? 783 784 if [ ${status} -gt 0 ] ; then 785 echo "IGCM_sys_RmRunDir : error code ${status}" 787 786 cat out_rsync 788 787 IGCM_debug_Exit "IGCM_sys_RmRunDir" 789 fi 790 788 else 789 \rm out_rsync 790 fi 791 791 IGCM_debug_PopStack "IGCM_sys_RmRunDir" 792 792 } … … 805 805 if [ $DRYRUN = 0 ]; then 806 806 807 typeset RET807 typeset status 808 808 809 809 echo mv $@ > out_rsync 2>&1 810 810 \mv $@ >> out_rsync 2>&1 811 RET=$?812 813 if [ ${ RET} -gt 0 ] ; then814 echo "IGCM_sys_Mv : error in mv."811 status=$? 812 813 if [ ${status} -gt 0 ] ; then 814 echo "IGCM_sys_Mv : error code ${status}" 815 815 cat out_rsync 816 816 IGCM_debug_Exit "IGCM_sys_Mv" 817 817 else 818 rm out_rsync818 \rm out_rsync 819 819 fi 820 820 else … … 842 842 fi 843 843 844 typeset RET845 846 847 848 849 850 \cp - R$1 $2 > out_rsync 2>&1851 RET=$?852 853 if [ ${ RET} -gt 0 ] ; then854 echo "IGCM_sys_Put_Dir : error ."844 typeset status 845 846 # Only if we use rsync 847 #IGCM_sys_TestDirArchive $( dirname $2 ) 848 # 849 #USUAL WAY 850 \cp -r $1 $2 > out_rsync 2>&1 851 status=$? 852 853 if [ ${status} -gt 0 ] ; then 854 echo "IGCM_sys_Put_Dir : error code ${status}" 855 855 cat out_rsync 856 856 IGCM_debug_Exit "IGCM_sys_Put_Dir" 857 857 else 858 rm out_rsync858 \rm out_rsync 859 859 fi 860 860 else … … 866 866 #D-#================================================== 867 867 #D-function IGCM_sys_Get_Dir 868 #D-* Purpose: Copy a complete directory from $ (ARCHIVE)868 #D-* Purpose: Copy a complete directory from ${ARCHIVE} 869 869 #D-* Examples: 870 870 #D- … … 881 881 fi 882 882 883 typeset RET883 typeset status 884 884 885 885 #USUAL WAY 886 886 \cp -R $1 $2 > out_rsync 2>&1 887 RET=$?888 889 if [ ${ RET} -gt 0 ] ; then887 status=$? 888 889 if [ ${status} -gt 0 ] ; then 890 890 echo "IGCM_sys_Get_Dir : error." 891 891 cat out_rsync 892 892 IGCM_debug_Exit "IGCM_sys_Get_Dir" 893 893 else 894 rm out_rsync894 \rm out_rsync 895 895 fi 896 896 else … … 917 917 fi 918 918 919 typeset RET919 typeset status 920 920 921 921 #USUAL WAY 922 922 cp -RL $1 $2 > out_rsync 2>&1 923 RET=$?924 925 if [ ${ RET} -gt 0 ] ; then923 status=$? 924 925 if [ ${status} -gt 0 ] ; then 926 926 echo "IGCM_sys_Get_Master : error." 927 927 cat out_rsync … … 938 938 #D-#================================================== 939 939 #D-function IGCM_sys_Put_Rest 940 #D-* Purpose: Put computied restarts on $ (ARCHIVE).940 #D-* Purpose: Put computied restarts on ${ARCHIVE}. 941 941 #D- File and target directory must exist. 942 942 #D-* Examples: … … 948 948 fi 949 949 if [ $DRYRUN = 0 ]; then 950 951 IGCM_sys_TestDirArchive $( dirname $2 )952 953 950 if [ ! -f ${1} ] ; then 954 951 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 955 952 IGCM_debug_Exit "IGCM_sys_Put_Rest" 956 953 fi 954 955 typeset status 956 # 957 957 if [ X${JobType} = XRUN ] ; then 958 958 IGCM_sys_Chmod 444 ${1} 959 959 fi 960 960 961 typeset RET 962 963 echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1 964 ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1 965 RET=$? 966 IGCM_sys_Rsync_out $RET 967 968 ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 969 (( RET=RET+$? )) 970 971 if [ ${RET} -gt 0 ] ; then 972 echo "IGCM_sys_Put_Rest : error." 961 # 962 # USUAL WAY 963 \cp $1 $2 > out_rsync 2>&1 964 status=$? 965 966 # #RSYNC WITH NETWORK SSH CALL 967 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 968 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 969 970 # #RSYNC WITH NFS USE 971 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 972 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 973 974 # status=$? 975 # IGCM_sys_Rsync_out $status 976 977 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 978 # (( status=status+$? )) 979 980 if [ ${status} -gt 0 ] ; then 981 echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 973 982 cat out_rsync 974 983 IGCM_debug_Exit "IGCM_sys_Put_Rest" 975 984 else 976 rm out_rsync985 \rm out_rsync 977 986 fi 978 987 else … … 999 1008 fi 1000 1009 1001 typeset RET1010 typeset status 1002 1011 # 1003 1012 if [ X${JobType} = XRUN ] ; then … … 1008 1017 # USUAL WAY 1009 1018 \cp $1 $2 > out_rsync 2>&1 1010 RET=$?1011 1012 if [ ${ RET} -gt 0 ] ; then1013 echo "IGCM_sys_PutBuffer_Rest : error ."1019 status=$? 1020 1021 if [ ${status} -gt 0 ] ; then 1022 echo "IGCM_sys_PutBuffer_Rest : error code ${status}" 1014 1023 cat out_rsync 1015 1024 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" … … 1025 1034 #D-#================================================== 1026 1035 #D-function IGCM_sys_Put_Out 1027 #D-* Purpose: Copy a file on $ (ARCHIVE) after havechmod it in readonly1036 #D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly 1028 1037 #D-* Examples: 1029 1038 #D- … … 1044 1053 fi 1045 1054 1046 typeset RET1055 typeset status 1047 1056 # 1048 1057 if [ X${JobType} = XRUN ] ; then … … 1051 1060 fi 1052 1061 fi 1053 1062 # 1054 1063 1055 1064 echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1 1056 1065 ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1 1057 RET=$?1058 IGCM_sys_Rsync_out $ RET1066 status=$? 1067 IGCM_sys_Rsync_out $status 1059 1068 1060 1069 ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1061 (( RET=RET+$? ))1062 1063 if [ ${ RET} -gt 0 ] ; then1070 (( status=status+$? )) 1071 1072 if [ ${status} -gt 0 ] ; then 1064 1073 echo "IGCM_sys_Put_Out : error." 1065 1074 cat out_rsync 1066 1075 IGCM_debug_Exit "IGCM_sys_Put_Out" 1067 1076 else 1068 rm out_rsync1077 \rm out_rsync 1069 1078 fi 1070 1079 else … … 1094 1103 IGCM_sys_Mkdir $( dirname $2 ) 1095 1104 # 1096 typeset RET1105 typeset status 1097 1106 1098 1107 if [ X${JobType} = XRUN ] ; then … … 1104 1113 # USUAL WAY 1105 1114 \cp $1 $2 > out_rsync 2>&1 1106 RET=$?1107 1108 if [ ${ RET} -gt 0 ] ; then1115 status=$? 1116 1117 if [ ${status} -gt 0 ] ; then 1109 1118 echo "IGCM_sys_PutBuffer_Out : error." 1110 1119 cat out_rsync … … 1128 1137 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1129 1138 1130 typeset DEST RET dm_liste ifile target1139 typeset DEST RET status dm_liste ifile target 1131 1140 1132 1141 if ( $DEBUG_sys ) ; then … … 1135 1144 if [ $DRYRUN -le 2 ]; then 1136 1145 if [ X${1} = X'/l' ] ; then 1137 1146 # test if the first file is present in the old computation : 1138 1147 eval set +A dm_liste \${${2}} 1139 1148 else … … 1142 1151 eval DEST=\${${#}} 1143 1152 1144 1153 # test if the (first) file is present in the old computation : 1145 1154 IGCM_sys_TestFileArchive ${dm_liste[0]} 1146 RET=$?1147 if [ ${ RET} -gt 0 ] ; then1155 status=$? 1156 if [ ${status} -gt 0 ] ; then 1148 1157 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1149 1158 IGCM_debug_Exit "IGCM_sys_Get" … … 1159 1168 # echo ${RSYNC} ${RSYNC_opt} $@ > out_rsync 2>&1 1160 1169 # ${RSYNC} ${RSYNC_opt} $@ >> out_rsync 2>&1 1161 # RET=$?1162 # IGCM_sys_Rsync_out $ RET1170 # status=$? 1171 # IGCM_sys_Rsync_out $status 1163 1172 1164 1173 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync … … 1166 1175 1167 1176 if [ ${RET} -gt 0 ] ; then 1168 echo "IGCM_sys_Get : copy error."1177 echo "IGCM_sys_Get : error" 1169 1178 cat out_rsync 1179 \rm out_rsync 1170 1180 IGCM_debug_Exit "IGCM_sys_Get" 1171 1181 else 1172 rm out_rsync1182 \rm out_rsync 1173 1183 fi 1174 1184 else … … 1186 1196 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1187 1197 1188 typeset DEST RET buf_liste ifile target file_work1198 typeset DEST RET status buf_liste ifile target file_work 1189 1199 1190 1200 if ( $DEBUG_sys ) ; then … … 1210 1220 else 1211 1221 \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 1212 RET=$?1222 status=$? 1213 1223 fi 1214 1224 1215 1225 if [ ${RET} -gt 0 ] ; then 1216 echo "IGCM_sys_GetBuffer : copy error."1226 echo "IGCM_sys_GetBuffer : error" 1217 1227 cat out_rsync 1228 \rm out_rsync 1218 1229 IGCM_debug_Exit "IGCM_sys_GetBuffer" 1219 1230 else … … 1263 1274 #D-#================================================== 1264 1275 #D-function IGCM_sys_Dods_Rm 1265 #D-* Purpose: Suppress files in /tmp/DODS for simulation ofinternet protocole.1276 #D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole. 1266 1277 #D-* Examples: 1267 1278 #D- … … 1276 1287 #D-#================================================== 1277 1288 #D-function IGCM_sys_Dods_Cp 1278 #D-* Purpose: Copy from $(ARCHIVE) files to /tmp/DODS for simulation ofinternet protocole.1289 #D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole. 1279 1290 #D-* Examples: 1280 1291 #D- … … 1288 1299 #D-#================================================== 1289 1300 #D-function IGCM_sys_Put_Dods 1290 #D-* Purpose: Put $(ARCHIVE) files on /tmp/DODS for simulation ofinternet protocole.1301 #D-* Purpose: Put $(ARCHIVE) files on DODS internet protocole. 1291 1302 #D-* Examples: 1292 1303 #D- … … 1296 1307 echo "IGCM_sys_Put_Dods :" $@ 1297 1308 fi 1298 if [ $DRYRUN = 0 ]; then1299 RET=01300 1301 if [ ${RET} -gt 0 ] ; then1302 echo "IGCM_sys_Put_Dods : error."1303 IGCM_debug_Exit "IGCM_sys_Put_Dods"1304 fi1305 else1306 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack1307 fi1308 1309 IGCM_debug_PopStack "IGCM_sys_Put_Dods" 1309 1310 } … … 1317 1318 echo "IGCM_sys_rebuild :" $@ 1318 1319 fi 1320 1321 typeset status 1322 1319 1323 /home/users/igcmg/rebuild/bin/rebuild -f -o $@ 1320 if [ $? -gt 0 ] ; then 1321 echo "IGCM_sys_rebuild : erreur ${@}." 1324 status=$? 1325 if [ ${status} -gt 0 ] ; then 1326 IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" 1322 1327 IGCM_debug_Exit "rebuild" 1323 1328 fi -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh
r714 r717 152 152 #- IN 153 153 typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM} 154 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/ dmnfs/cont003/p24data}154 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/ccc/work/cont003/dsm/p24data} 155 155 156 156 #==================================================== … … 853 853 fi 854 854 855 typeset RETDEST855 typeset status DEST 856 856 857 857 mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} … … 859 859 echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 860 860 ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 861 RET=$?862 863 if [ ${ RET} -gt 0 ] ; then861 status=$? 862 863 if [ ${status} -gt 0 ] ; then 864 864 echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium." 865 865 cat out_rsync … … 879 879 fi 880 880 881 typeset RET881 typeset status 882 882 883 883 echo cp $@ > out_rsync 2>&1 884 884 \cp $@ >> out_rsync 2>&1 885 RET=$?886 887 if [ ${ RET} -gt 0 ] ; then888 echo "IGCM_sys_Cp : error ."885 status=$? 886 887 if [ ${status} -gt 0 ] ; then 888 echo "IGCM_sys_Cp : error code ${status}" 889 889 cat out_rsync 890 890 IGCM_debug_Exit "IGCM_sys_Cp" … … 906 906 fi 907 907 908 typeset RET908 typeset status 909 909 910 910 echo rm $@ > out_rsync 2>&1 911 911 \rm $@ >> out_rsync 2>&1 912 RET=$?913 914 if [ ${ RET} -gt 0 ] ; then915 echo "IGCM_sys_Rm : error ."912 status=$? 913 914 if [ ${status} -gt 0 ] ; then 915 echo "IGCM_sys_Rm : error code ${status}" 916 916 cat out_rsync 917 917 IGCM_debug_Exit "IGCM_sys_Rm" … … 934 934 fi 935 935 936 typeset RET936 typeset status 937 937 938 938 echo rm $@ > out_rsync 2>&1 939 939 \rm $@ >> out_rsync 2>&1 940 RET=$?941 942 if [ ${ RET} -gt 0 ] ; then943 echo "IGCM_sys_RmRunDir : error ."940 status=$? 941 942 if [ ${status} -gt 0 ] ; then 943 echo "IGCM_sys_RmRunDir : error code ${status}" 944 944 cat out_rsync 945 945 IGCM_debug_Exit "IGCM_sys_RmRunDir" … … 963 963 if [ $DRYRUN = 0 ]; then 964 964 965 typeset RET965 typeset status 966 966 967 967 echo mv $@ > out_rsync 2>&1 968 968 \mv $@ >> out_rsync 2>&1 969 RET=$?970 971 if [ ${ RET} -gt 0 ] ; then972 echo "IGCM_sys_Mv : error in mv."969 status=$? 970 971 if [ ${status} -gt 0 ] ; then 972 echo "IGCM_sys_Mv : error code ${status}" 973 973 cat out_rsync 974 974 IGCM_debug_Exit "IGCM_sys_Mv" … … 1000 1000 fi 1001 1001 1002 typeset RET1002 typeset status 1003 1003 1004 1004 # Only if we use rsync … … 1007 1007 #USUAL WAY 1008 1008 \cp -r $1 $2 > out_rsync 2>&1 1009 RET=$?1010 1011 if [ ${ RET} -gt 0 ] ; then1012 echo "IGCM_sys_Put_Dir : error ."1009 status=$? 1010 1011 if [ ${status} -gt 0 ] ; then 1012 echo "IGCM_sys_Put_Dir : error code ${status}" 1013 1013 cat out_rsync 1014 1014 IGCM_debug_Exit "IGCM_sys_Put_Dir" … … 1039 1039 # fi 1040 1040 1041 typeset RET 1041 typeset NB_ESSAI DELAI status i 1042 # number of tentative 1043 NB_ESSAI=3 1044 # time delay between tentative 1045 DELAI=2 1042 1046 1043 1047 # Only if we use rsync … … 1048 1052 #dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget 1049 1053 ccc_hsm get -r $1 1050 \cp -r $1 $2 > out_rsync 2>&1 1051 RET=$? 1052 1053 if [ ${RET} -gt 0 ] ; then 1054 1055 i=0 1056 while [ $i -lt $NB_ESSAI ] ; do 1057 \cp -ur $1 $2 >> out_rsync 2>&1 1058 status=$? 1059 if [ ${status} -gt 0 ]; then 1060 IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status} ${i}/${NB_ESSAI}" 1061 IGCM_debug_Print 2 "IGCM_sys_Get_Dir : sleep ${DELAI} seconds and try again." 1062 sleep $DELAI 1063 else 1064 break 1065 fi 1066 (( i = i + 1 )) 1067 done 1068 1069 if [ ${status} -gt 0 ] ; then 1054 1070 echo "IGCM_sys_Get_Dir : error." 1055 1071 cat out_rsync … … 1081 1097 fi 1082 1098 1083 typeset RET 1084 1085 #USUAL WAY 1086 \cp -rL $1 $2 > out_rsync 2>&1 1087 RET=$? 1088 1089 if [ ${RET} -gt 0 ] ; then 1099 typeset NB_ESSAI DELAI status i 1100 # number of tentative 1101 NB_ESSAI=3 1102 # time delay between tentative 1103 DELAI=2 1104 1105 i=0 1106 while [ $i -lt $NB_ESSAI ] ; do 1107 \cp -urL $1 $2 > out_rsync 2>&1 1108 status=$? 1109 if [ ${status} -gt 0 ]; then 1110 IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}" 1111 IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." 1112 sleep $DELAI 1113 else 1114 break 1115 fi 1116 (( i = i + 1 )) 1117 done 1118 1119 if [ ${status} -gt 0 ] ; then 1090 1120 echo "IGCM_sys_Get_Master : error." 1091 1121 cat out_rsync … … 1123 1153 fi 1124 1154 1125 typeset RET1155 typeset status 1126 1156 # 1127 1157 if [ X${JobType} = XRUN ] ; then … … 1132 1162 # USUAL WAY 1133 1163 \cp $1 $2 > out_rsync 2>&1 1134 RET=$?1164 status=$? 1135 1165 1136 1166 # #RSYNC WITH NETWORK SSH CALL … … 1142 1172 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 1143 1173 1144 # RET=$?1145 # IGCM_sys_Rsync_out $ RET1174 # status=$? 1175 # IGCM_sys_Rsync_out $status 1146 1176 1147 1177 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1148 # (( RET=RET+$? ))1149 1150 if [ ${ RET} -gt 0 ] ; then1151 echo "IGCM_sys_Put_Rest : error."1178 # (( status=status+$? )) 1179 1180 if [ ${status} -gt 0 ] ; then 1181 echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 1152 1182 cat out_rsync 1153 1183 IGCM_debug_Exit "IGCM_sys_Put_Rest" … … 1178 1208 fi 1179 1209 1180 typeset RET1210 typeset status 1181 1211 # 1182 1212 if [ X${JobType} = XRUN ] ; then … … 1187 1217 # USUAL WAY 1188 1218 \cp $1 $2 > out_rsync 2>&1 1189 RET=$?1190 1191 if [ ${ RET} -gt 0 ] ; then1192 echo "IGCM_sys_PutBuffer_Rest : error ."1219 status=$? 1220 1221 if [ ${status} -gt 0 ] ; then 1222 echo "IGCM_sys_PutBuffer_Rest : error code ${status}" 1193 1223 cat out_rsync 1194 1224 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" … … 1213 1243 fi 1214 1244 1215 typeset NB_ESSAI DELAI RET i1245 typeset NB_ESSAI DELAI status i exist skip 1216 1246 1217 1247 # number of tentative … … 1251 1281 # 1252 1282 1253 (( i = 0 )) 1254 while [ $i -lt $NB_ESSAI ] ; do 1255 # USUAL WAY 1256 \cp $1 $2 > out_rsync 2>&1 1257 RET=$? 1258 if [ ${RET} -gt 0 ]; then 1259 IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed ${i}/${NB_ESSAI}" 1260 IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 1261 sleep $DELAI 1283 exist=false 1284 skip=false 1285 if [ -f $2 ] ; then 1286 IGCM_debug_Print 1 "$2 already exist" 1287 #dmget $2 1288 ccc_hsm get $2 1289 exist=true 1290 if [ "X$( diff $1 $2 )" = X ] ; then 1291 IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 1292 skip=true 1262 1293 else 1263 break 1294 IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 1295 skip=false 1264 1296 fi 1265 (( i = i + 1 )) 1266 done 1297 fi 1298 # 1299 if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 1300 IGCM_sys_Chmod u+w $2 1301 fi 1302 1303 if [ X${skip} = Xfalse ] ; then 1304 (( i = 0 )) 1305 while [ $i -lt $NB_ESSAI ] ; do 1306 # USUAL WAY 1307 \cp $1 $2 > out_rsync 2>&1 1308 status=$? 1309 if [ ${status} -gt 0 ]; then 1310 IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 1311 IGCM_debug_Print 2 "IGCM_sys_Put_Out : sleep ${DELAI} seconds and try again." 1312 sleep $DELAI 1313 else 1314 break 1315 fi 1316 (( i = i + 1 )) 1317 done 1318 fi 1267 1319 1268 1320 # #RSYNC WITH NETWORK SSH CALL … … 1274 1326 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 1275 1327 1276 # RET=$?1277 # IGCM_sys_Rsync_out $ RET1328 # status=$? 1329 # IGCM_sys_Rsync_out $status 1278 1330 1279 1331 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1280 # (( RET=RET+$? ))1281 1282 if [ ${ RET} -gt 0 ] ; then1332 # (( status=status+$? )) 1333 1334 if [ ${status} -gt 0 ] ; then 1283 1335 echo "IGCM_sys_Put_Out : error." 1284 1336 cat out_rsync … … 1304 1356 echo "IGCM_sys_PutBuffer_Out :" $@ 1305 1357 fi 1358 1359 typeset NB_ESSAI DELAI status i exist skip 1360 1361 # number of tentative 1362 NB_ESSAI=3 1363 # time delay between tentative 1364 DELAI=2 1365 1306 1366 if [ $DRYRUN = 0 ]; then 1307 1367 if [ ! -f ${1} ] ; then … … 1313 1373 IGCM_sys_Mkdir $( dirname $2 ) 1314 1374 # 1315 typeset RET1316 1375 1317 1376 if [ X${JobType} = XRUN ] ; then … … 1320 1379 fi 1321 1380 fi 1381 1382 exist=false 1383 skip=false 1384 if [ -f $2 ] ; then 1385 IGCM_debug_Print 1 "$2 already exist" 1386 exist=true 1387 if [ "X$( diff $1 $2 )" = X ] ; then 1388 IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" 1389 skip=true 1390 else 1391 IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" 1392 skip=false 1393 fi 1394 fi 1322 1395 # 1323 # USUAL WAY 1324 \cp $1 $2 > out_rsync 2>&1 1325 RET=$? 1326 1327 if [ ${RET} -gt 0 ] ; then 1396 if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then 1397 IGCM_sys_Chmod u+w $2 1398 fi 1399 1400 if [ X${skip} = Xfalse ] ; then 1401 i=0 1402 while [ $i -lt $NB_ESSAI ] ; do 1403 # USUAL WAY 1404 \cp $1 $2 > out_rsync 2>&1 1405 status=$? 1406 if [ ${status} -gt 0 ]; then 1407 IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" 1408 IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again." 1409 sleep $DELAI 1410 else 1411 break 1412 fi 1413 (( i = i + 1 )) 1414 done 1415 fi 1416 1417 if [ ${status} -gt 0 ] ; then 1328 1418 echo "IGCM_sys_PutBuffer_Out : error." 1329 1419 cat out_rsync … … 1385 1475 1386 1476 ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 1387 RET=$?1388 if [ ${ RET} -gt 0 ] ; then1389 echo "WARNING IGCM_sys_Get : demigration error."1477 status=$? 1478 if [ ${status} -gt 0 ] ; then 1479 echo "WARNING IGCM_sys_Get : error code ${status}" 1390 1480 cat out_rsync 1391 1481 echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 1392 1482 fi 1393 1483 1394 #if [ ${ RET} -gt 0 ] ; then1484 #if [ ${status} -gt 0 ] ; then 1395 1485 # if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 1396 1486 # cat out_rsync … … 1400 1490 ## dmget ${dm_liste[*]} > out_rsync 2>&1 1401 1491 # ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 1402 # RET=$?1403 # if [ ${ RET} -gt 0 ] ; then1492 # status=$? 1493 # if [ ${status} -gt 0 ] ; then 1404 1494 # echo "ERROR IGCM_sys_Get : again demigration error :" 1405 1495 # cat out_rsync … … 1421 1511 # test if the target file is present before the loop 1422 1512 IGCM_sys_TestFileArchive ${target} 1423 RET=$?1424 if [ ${ RET} -gt 0 ] ; then1513 status=$? 1514 if [ ${status} -gt 0 ] ; then 1425 1515 echo "IGCM_sys_Get, ERROR : regular file ${target} DOES NOT EXIST ." 1426 1516 IGCM_debug_Exit "IGCM_sys_Get" … … 1430 1520 status=$? 1431 1521 if [ ${status} -gt 0 ]; then 1432 IGCM_debug_Print 2 "IGCM_sys_Get : cp failed${i}/${NB_ESSAI}"1433 1434 1522 IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status} ${i}/${NB_ESSAI}" 1523 IGCM_debug_Print 2 "IGCM_sys_Get : sleep ${DELAI} seconds and try again." 1524 sleep $DELAI 1435 1525 else 1436 1526 break 1437 1527 fi 1438 1528 (( i = i + 1 )) … … 1443 1533 else 1444 1534 \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 1445 RET=$?1535 status=$? 1446 1536 fi 1447 1537 … … 1454 1544 # ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 1455 1545 1456 # RET=$?1457 # IGCM_sys_Rsync_out $ RET1546 # status=$? 1547 # IGCM_sys_Rsync_out $status 1458 1548 1459 1549 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync … … 1461 1551 1462 1552 if [ ${RET} -gt 0 ] ; then 1463 echo "IGCM_sys_Get : copy error."1553 echo "IGCM_sys_Get : error" 1464 1554 cat out_rsync 1555 \rm out_rsync 1465 1556 IGCM_debug_Exit "IGCM_sys_Get" 1466 1557 else … … 1481 1572 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1482 1573 1483 typeset DEST RET buf_liste ifile target file_work1574 typeset DEST RET status buf_liste ifile target file_work 1484 1575 1485 1576 if ( $DEBUG_sys ) ; then … … 1505 1596 else 1506 1597 \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 1507 RET=$?1598 status=$? 1508 1599 fi 1509 1600 1510 1601 if [ ${RET} -gt 0 ] ; then 1511 echo "IGCM_sys_GetBuffer : copy error."1602 echo "IGCM_sys_GetBuffer : error" 1512 1603 cat out_rsync 1604 \rm out_rsync 1513 1605 IGCM_debug_Exit "IGCM_sys_GetBuffer" 1514 1606 else … … 1565 1657 echo "IGCM_sys_Dods_Rm :" $@ 1566 1658 fi 1567 typeset RET 1568 RET=0 1659 typeset status 1569 1660 if [ $DRYRUN = 0 ]; then 1570 1661 … … 1576 1667 1577 1668 /ccc/cont003/home/dsm/p86ipsl/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 1578 RET=$?1579 1580 # if [ ${ RET} -gt 0 ] ; then1669 status=$? 1670 1671 # if [ ${status} -gt 0 ] ; then 1581 1672 # echo "IGCM_sys_Dods_Rm : error." 1582 1673 # cat out_dods_rm … … 1589 1680 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1590 1681 fi 1591 return $ RET1682 return $status 1592 1683 } 1593 1684 … … 1601 1692 echo "IGCM_sys_Dods_Cp :" $@ 1602 1693 fi 1603 typeset RET 1604 RET=0 1694 typeset status 1605 1695 if [ $DRYRUN = 0 ]; then 1606 1696 … … 1612 1702 1613 1703 /ccc/cont003/home/dsm/p86ipsl/bin/dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1 1614 RET=$?1615 1616 # if [ ${ RET} -gt 0 ] ; then1704 status=$? 1705 1706 # if [ ${status} -gt 0 ] ; then 1617 1707 # echo "IGCM_sys_Dods_Cp : error." 1618 1708 # cat out_dods_cp … … 1625 1715 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1626 1716 fi 1627 return $ RET1717 return $status 1628 1718 } 1629 1719 … … 1638 1728 echo "IGCM_sys_Put_Dods :" $@ 1639 1729 fi 1640 set -vx1641 typeset RET1730 #set -vx 1731 typeset status 1642 1732 if [ $DRYRUN = 0 ]; then 1643 1733 if ( [ ! -d ${R_SAVE}/${1} ] && [ ! -d ${R_FIGR}/${1} ] ) ; then … … 1665 1755 IGCM_sys_Dods_Rm ${1} 1666 1756 IGCM_sys_Dods_Cp ${1} 1667 RET=01668 1669 if [ ${ RET} -gt 0 ] ; then1757 status=0 1758 1759 if [ ${status} -gt 0 ] ; then 1670 1760 echo "IGCM_sys_Put_Dods : error." 1671 1761 IGCM_debug_Exit "IGCM_sys_Put_Dods" … … 1685 1775 echo "IGCM_sys_rebuild :" $@ 1686 1776 fi 1687 /home/cont003/p86ipsl/X64/bin/rebuild -f -o $@ 1777 1778 typeset NB_ESSAI DELAI status i 1779 # number of tentative 1780 NB_ESSAI=3 1781 # time delay between tentative 1782 DELAI=2 1783 1784 i=0 1785 while [ $i -lt $NB_ESSAI ] ; do 1786 /home/cont003/p86ipsl/X64/bin/rebuild -f -o $@ > out_rsync 2>&1 1787 status=$? 1788 if [ ${status} -gt 0 ] ; then 1789 IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" 1790 cat out_rsync 1791 \rm out_rsync 1792 IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 1793 else 1794 \rm out_rsync 1795 break 1796 fi 1797 (( i = i + 1 )) 1798 done 1799 1688 1800 if [ $? -gt 0 ] ; then 1689 echo "IGCM_sys_rebuild : erreur ${@}."1801 echo "IGCM_sys_rebuild : rebuild error" 1690 1802 IGCM_debug_Exit "rebuild" 1691 1803 fi
Note: See TracChangeset
for help on using the changeset viewer.