- Timestamp:
- 03/30/15 14:17:55 (9 years ago)
- Location:
- trunk/libIGCM/libIGCM_sys
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh
r1174 r1178 85 85 # ie storage filesystem 86 86 typeset -r STOREHOST=${MASTER} 87 88 #====================================================89 # Source default environment90 #====================================================91 ##. /etc/profile92 87 93 88 #==================================================== … … 1068 1063 fi 1069 1064 if [ $DRYRUN = 0 ]; then 1070 # if [ ! -d ${1} ] ; then1071 # echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."1072 # IGCM_debug_PopStack "IGCM_sys_Get_Dir"1073 # return1074 # fi1075 1076 1065 typeset NB_ESSAI DELAI status i 1077 1066 # number of tentative … … 1102 1091 1103 1092 if [ ${status} -gt 0 ] ; then 1104 echo "IGCM_sys_Get_Dir : error."1093 IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status}" 1105 1094 cat /tmp/out_command.$$ 1106 1095 IGCM_debug_Exit "IGCM_sys_Get_Dir" … … 1267 1256 #D-#================================================== 1268 1257 #D-function IGCM_sys_PrepareTaredRestart 1269 #D-* Purpose: Prepare tared restart to be access by computing job. Identity here.1258 #D-* Purpose: Prepare tared restart to be access by computing job. 1270 1259 #D-* Examples: 1271 1260 #D- … … 1305 1294 IGCM_sys_MkdirArchive $( dirname $2 ) 1306 1295 # 1307 1308 #=====================================================1309 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR1310 #=====================================================1311 1312 #echo ${2} | grep "${R_OUT}" > /dev/null 2>&11313 #if [ $? -eq 0 ] ; then1314 # typeset WORKPATH FILEPATH1315 # WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" )1316 # IGCM_sys_MkdirWork ${WORKPATH}1317 # FILEPATH=${WORKPATH}/$( basename $2 )1318 # #1319 # IGCM_sys_Cp ${1} ${FILEPATH}1320 #fi1321 1322 1296 exist=false 1323 1297 skip=false … … 1523 1497 fi 1524 1498 eval DEST=\${${#}} 1525 1526 #=====================================================1527 # COMMENT OUT DOUBLE COPY ON SCRATCHDIR1528 #=====================================================1529 1530 # Is it an R_OUT file (not R_IN) ?1531 #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&11532 #if [ $? -eq 0 ] ; then1533 # # Yes ? then we try to get it in SCRATCHDIR1534 # set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_BUF}|g" )1535 # if [ -f ${file_work[0]} ] ; then1536 # IGCM_sys_Cp ${file_work[*]} ${DEST}1537 # IGCM_debug_PopStack "IGCM_sys_Get"1538 # return1539 # fi1540 #fi1541 1542 1499 ccc_hsm get ${dm_liste[*]} > /tmp/out_command.$$ 2>&1 1543 1500 status=$? … … 1869 1826 #D-#================================================== 1870 1827 #D-function IGCM_sys_Put_Dods 1871 #D-* Purpose: Put $ (ARCHIVE)files on DODS internet protocole.1828 #D-* Purpose: Put ${ARCHIVE} files on DODS internet protocole. 1872 1829 #D-* Examples: 1873 1830 #D- … … 2317 2274 string_final="" 2318 2275 for index in `seq $slot $(($slot+$comp_proc_omp_loc-1))`; do 2319 (( index_slot = index * 2 )) 2276 (( index_slot = index * 2 )) 2320 2277 string=$index_slot$virg 2321 2278 string_final=$string_final$string -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_default.ksh
r1163 r1178 68 68 typeset LOGIN=${LOGIN:=$( whoami )} 69 69 # $hostname of the MASTER job 70 typeset -rMASTER=${HOST}70 typeset MASTER=${HOST} 71 71 72 72 #D- … … 175 175 fi 176 176 177 # ON OBELIXNO SPECIAL CASE WHEN X${config_UserChoices_SpaceName} = XTEST177 # ON DEFAULT MACHINE NO SPECIAL CASE WHEN X${config_UserChoices_SpaceName} = XTEST 178 178 179 179 #==================================================== … … 236 236 237 237 #D-#================================================== 238 #D-function IGCM_sys_RshArchive_NoError 239 #D-* Purpose: Archive rsh command, without error 240 #D-* used only in monitoring.job 241 #D-* Examples: 242 #D- 243 function IGCM_sys_RshArchive_NoError { 244 IGCM_debug_PushStack "IGCM_sys_RshArchive_NoError" $@ 245 /bin/ksh <<-EOF 246 ${@} 2> \dev\null 247 EOF 248 IGCM_debug_PopStack "IGCM_sys_RshArchive_NoError" 249 } 250 251 #D-#================================================== 238 252 #D-function IGCM_sys_RshPost 239 253 #D-* Purpose: Post-process rsh command … … 245 259 echo "IGCM_sys_RshPost :" $@ 246 260 fi 247 248 261 # keep standard input (stdin) for the loop onto temporary file 249 cat > tmp_IGCM_sys_RshPost_$$250 251 /bin/ksh < tmp_IGCM_sys_RshPost_$$262 cat >/tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 263 264 /bin/ksh </tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 252 265 if [ $? -gt 0 ] ; then 253 266 echo "IGCM_sys_RshPost : erreur." … … 255 268 fi 256 269 # delete temporary file 257 \rm tmp_IGCM_sys_RshPost_$$270 \rm /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 258 271 IGCM_debug_PopStack "IGCM_sys_RshPost" 259 272 } … … 334 347 fi 335 348 #- creation de repertoire sur le serveur fichier 336 mkdir -p $1 337 status=$? 338 339 if [ ${status} -gt 0 ] ; then 340 IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : mkdir failed error code ${status}" 341 IGCM_debug_Exit "IGCM_sys_MkdirArchive" 349 if [ ! -d ${1} ]; then 350 \mkdir -p $1 351 status=$? 352 353 if [ ${status} -gt 0 ] ; then 354 IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : mkdir failed error code ${status}" 355 IGCM_debug_Exit "IGCM_sys_MkdirArchive" 356 fi 342 357 fi 343 358 IGCM_debug_PopStack "IGCM_sys_MkdirArchive" … … 537 552 fi 538 553 539 \ tree -f $@554 \ls -lR ${@} 540 555 541 556 IGCM_debug_PopStack "IGCM_sys_Tree" … … 746 761 mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} 747 762 748 echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > /tmp/out_command .$$ 2>&1749 ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> /tmp/out_command .$$ 2>&1763 echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > /tmp/out_command_${LOGIN}.$$ 2>&1 764 ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> /tmp/out_command_${LOGIN}.$$ 2>&1 750 765 status=$? 751 766 752 767 if [ ${status} -gt 0 ] ; then 753 768 echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on frontend." 754 cat /tmp/out_command .$$769 cat /tmp/out_command_${LOGIN}.$$ 755 770 fi 756 771 IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" … … 770 785 typeset status 771 786 772 echo cp $@ > /tmp/out_command .$$ 2>&1773 \cp $@ >> /tmp/out_command .$$ 2>&1787 echo cp $@ > /tmp/out_command_${LOGIN}.$$ 2>&1 788 \cp $@ >> /tmp/out_command_${LOGIN}.$$ 2>&1 774 789 status=$? 775 790 776 791 if [ ${status} -gt 0 ] ; then 777 792 echo "IGCM_sys_Cp : error code ${status}" 778 cat /tmp/out_command .$$793 cat /tmp/out_command_${LOGIN}.$$ 779 794 IGCM_debug_Exit "IGCM_sys_Cp" 780 795 else 781 \rm /tmp/out_command .$$796 \rm /tmp/out_command_${LOGIN}.$$ 782 797 fi 783 798 IGCM_debug_PopStack "IGCM_sys_Cp" … … 797 812 typeset status 798 813 799 echo rm $@ > /tmp/out_command .$$ 2>&1800 \rm $@ >> /tmp/out_command .$$ 2>&1814 echo rm $@ > /tmp/out_command_${LOGIN}.$$ 2>&1 815 \rm $@ >> /tmp/out_command_${LOGIN}.$$ 2>&1 801 816 status=$? 802 817 803 818 if [ ${status} -gt 0 ] ; then 804 819 echo "IGCM_sys_Rm : error code ${status}" 805 cat /tmp/out_command .$$820 cat /tmp/out_command_${LOGIN}.$$ 806 821 IGCM_debug_Exit "IGCM_sys_Rm" 807 822 else 808 \rm /tmp/out_command .$$823 \rm /tmp/out_command_${LOGIN}.$$ 809 824 fi 810 825 IGCM_debug_PopStack "IGCM_sys_Rm" … … 842 857 typeset status 843 858 844 echo mv $@ > /tmp/out_command .$$ 2>&1845 \mv $@ >> /tmp/out_command .$$ 2>&1859 echo mv $@ > /tmp/out_command_${LOGIN}.$$ 2>&1 860 \mv $@ >> /tmp/out_command_${LOGIN}.$$ 2>&1 846 861 status=$? 847 862 848 863 if [ ${status} -gt 0 ] ; then 849 864 echo "IGCM_sys_Mv : error code ${status}" 850 cat /tmp/out_command .$$865 cat /tmp/out_command_${LOGIN}.$$ 851 866 IGCM_debug_Exit "IGCM_sys_Mv" 852 867 else 853 \rm /tmp/out_command.$$ 854 fi 855 fi 856 868 \rm /tmp/out_command_${LOGIN}.$$ 869 fi 870 fi 857 871 IGCM_debug_PopStack "IGCM_sys_Mv" 858 872 } … … 881 895 # 882 896 #USUAL WAY 883 \cp -r $1 $2 > /tmp/out_command .$$ 2>&1897 \cp -r $1 $2 > /tmp/out_command_${LOGIN}.$$ 2>&1 884 898 status=$? 885 899 886 900 if [ ${status} -gt 0 ] ; then 887 901 IGCM_debug_Print 2 "IGCM_sys_Put_Dir : cp failed error code ${status}" 888 cat /tmp/out_command .$$902 cat /tmp/out_command_${LOGIN}.$$ 889 903 IGCM_debug_Exit "IGCM_sys_Put_Dir" 890 904 else 891 \rm /tmp/out_command .$$905 \rm /tmp/out_command_${LOGIN}.$$ 892 906 fi 893 907 fi … … 906 920 fi 907 921 if [ $DRYRUN = 0 ]; then 908 if [ ! -d ${1} ] ; then909 echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."910 IGCM_debug_PopStack "IGCM_sys_Get_Dir"911 return912 fi913 914 922 typeset status 915 923 916 924 #USUAL WAY 917 \cp -ur $1 $2 > /tmp/out_command .$$ 2>&1925 \cp -ur $1 $2 > /tmp/out_command_${LOGIN}.$$ 2>&1 918 926 status=$? 919 927 920 928 if [ ${status} -gt 0 ] ; then 921 929 IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status}" 922 cat /tmp/out_command .$$930 cat /tmp/out_command_${LOGIN}.$$ 923 931 IGCM_debug_Exit "IGCM_sys_Get_Dir" 924 932 else 925 \rm /tmp/out_command .$$933 \rm /tmp/out_command_${LOGIN}.$$ 926 934 fi 927 935 fi … … 954 962 i=0 955 963 while [ $i -lt $NB_ESSAI ] ; do 956 \cp -urL $1 $2 > /tmp/out_command .$$ 2>&1964 \cp -urL $1 $2 > /tmp/out_command_${LOGIN}.$$ 2>&1 957 965 status=$? 958 966 if [ ${status} -gt 0 ]; then … … 968 976 if [ ${status} -gt 0 ] ; then 969 977 echo "IGCM_sys_Get_Master : error." 970 cat /tmp/out_command .$$978 cat /tmp/out_command_${LOGIN}.$$ 971 979 IGCM_debug_Exit "IGCM_sys_Get_Master" 972 980 else 973 \rm /tmp/out_command .$$981 \rm /tmp/out_command_${LOGIN}.$$ 974 982 fi 975 983 fi … … 1002 1010 typeset status 1003 1011 # 1004 if [ X${JobType} = XRUN ] ; then 1005 IGCM_sys_Chmod 444 ${1} 1006 fi 1007 # 1008 # Only if we use rsync 1009 #IGCM_sys_MkdirArchive $( dirname $2 ) 1010 # 1011 #USUAL WAY 1012 # USUAL WAY 1012 1013 \cp $1 $2 > /tmp/out_command.$$ 2>&1 1013 1014 status=$? 1014 1015 1015 1016 # #RSYNC WITH NETWORK SSH CALL 1016 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > /tmp/out_command .$$ 2>&11017 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> /tmp/out_command .$$ 2>&11017 # echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > /tmp/out_command_${LOGIN}.$$ 2>&1 1018 # ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> /tmp/out_command_${LOGIN}.$$ 2>&1 1018 1019 1019 1020 # #RSYNC WITH NFS USE 1020 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > /tmp/out_command .$$ 2>&11021 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> /tmp/out_command .$$ 2>&11021 # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > /tmp/out_command_${LOGIN}.$$ 2>&1 1022 # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> /tmp/out_command_${LOGIN}.$$ 2>&1 1022 1023 1023 1024 # status=$? 1024 1025 # IGCM_sys_Rsync_out $status 1025 1026 1026 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk /tmp/out_command .$$1027 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk /tmp/out_command_${LOGIN}.$$ 1027 1028 # (( status=status+$? )) 1028 1029 1029 1030 if [ ${status} -gt 0 ] ; then 1030 1031 echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 1032 [ -f ${1} ] && ls -l ${1} 1033 [ -f ${2} ] && ls -l ${2} 1034 [ -f ${2}/${1} ] && ls -l ${2}/${1} 1031 1035 cat /tmp/out_command.$$ 1032 1036 IGCM_debug_Exit "IGCM_sys_Put_Rest" 1033 1037 else 1038 1039 if [ X${JobType} = XRUN ] ; then 1040 [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} 1041 [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} 1042 fi 1043 1034 1044 \rm /tmp/out_command.$$ 1035 1045 fi … … 1056 1066 1057 1067 typeset status 1058 #1059 if [ X${JobType} = XRUN ] ; then1060 IGCM_sys_Chmod 444 ${1}1061 fi1062 1063 1068 # 1064 1069 # USUAL WAY … … 1073 1078 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 1074 1079 else 1080 1081 if [ X${JobType} = XRUN ] ; then 1082 [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} 1083 [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} 1084 fi 1085 1075 1086 \rm /tmp/out_command.$$ 1076 1087 fi … … 1119 1130 # 1120 1131 1121 echo ${RSYNC} ${RSYNC_opt} $1 $2 > /tmp/out_command .$$ 2>&11122 ${RSYNC} ${RSYNC_opt} $1 $2 >> /tmp/out_command .$$ 2>&11132 echo ${RSYNC} ${RSYNC_opt} $1 $2 > /tmp/out_command_${LOGIN}.$$ 2>&1 1133 ${RSYNC} ${RSYNC_opt} $1 $2 >> /tmp/out_command_${LOGIN}.$$ 2>&1 1123 1134 status=$? 1124 1135 IGCM_sys_Rsync_out $status 1125 1136 1126 ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk /tmp/out_command .$$1137 ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk /tmp/out_command_${LOGIN}.$$ 1127 1138 (( status=status+$? )) 1128 1139 1129 1140 if [ ${status} -gt 0 ] ; then 1130 1141 IGCM_debug_Print 2 "IGCM_sys_Put_Out : rsync failed error code ${status}" 1131 cat /tmp/out_command .$$1142 cat /tmp/out_command_${LOGIN}.$$ 1132 1143 IGCM_debug_Exit "IGCM_sys_Put_Out" 1133 1144 else 1134 \rm /tmp/out_command .$$1145 \rm /tmp/out_command_${LOGIN}.$$ 1135 1146 fi 1136 1147 fi … … 1189 1200 i=0 1190 1201 while [ $i -lt $NB_ESSAI ] ; do 1191 # USUAL WAY 1192 \cp $1 $2 > /tmp/out_command.$$ 2>&1 1193 status=$? 1202 if [ $( stat -c %d $1 ) -ne $( stat -c %d $( dirname $2 ) ) ] ; then 1203 # USUAL WAY 1204 \cp $1 $2 > /tmp/out_command.$$ 2>&1 1205 status=$? 1206 else 1207 # NOT SO USUAL WAY 1208 \mv $1 $2 > /tmp/out_command.$$ 2>&1 1209 status=$? 1210 fi 1194 1211 if [ ${status} -gt 0 ]; then 1195 1212 IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" … … 1258 1275 1259 1276 #USUAL WAY 1260 \cp ${dm_liste[*]} ${DEST} > /tmp/out_command .$$ 2>&11277 \cp ${dm_liste[*]} ${DEST} > /tmp/out_command_${LOGIN}.$$ 2>&1 1261 1278 status=$? 1262 1279 1263 1280 if [ ${status} -gt 0 ] ; then 1264 1281 IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status}" 1265 cat /tmp/out_command .$$1282 cat /tmp/out_command_${LOGIN}.$$ 1266 1283 IGCM_debug_Exit "IGCM_sys_Get" 1267 1284 else 1268 \rm /tmp/out_command .$$1285 \rm /tmp/out_command_${LOGIN}.$$ 1269 1286 fi 1270 1287 fi … … 1306 1323 i=0 1307 1324 while [ $i -lt $NB_ESSAI ] ; do 1308 \cp ${target} ${DEST}/${local_file} >> /tmp/out_command .$$ 2>&11325 \cp ${target} ${DEST}/${local_file} >> /tmp/out_command_${LOGIN}.$$ 2>&1 1309 1326 status=$? 1310 1327 if [ ${status} -gt 0 ]; then … … 1319 1336 if [ ${status} -gt 0 ] ; then 1320 1337 echo "IGCM_sys_Get : error" 1321 cat /tmp/out_command .$$1322 \rm /tmp/out_command .$$1338 cat /tmp/out_command_${LOGIN}.$$ 1339 \rm /tmp/out_command_${LOGIN}.$$ 1323 1340 IGCM_debug_Exit "IGCM_sys_GetBuffer" 1324 1341 else 1325 \rm /tmp/out_command .$$1342 \rm /tmp/out_command_${LOGIN}.$$ 1326 1343 fi 1327 1344 done … … 1329 1346 i=0 1330 1347 while [ $i -lt $NB_ESSAI ] ; do 1331 \cp ${buf_liste} ${DEST} >> /tmp/out_command .$$ 2>&11348 \cp ${buf_liste} ${DEST} >> /tmp/out_command_${LOGIN}.$$ 2>&1 1332 1349 status=$? 1333 1350 if [ ${status} -gt 0 ]; then … … 1342 1359 if [ ${status} -gt 0 ] ; then 1343 1360 echo "IGCM_sys_Get : error" 1344 cat /tmp/out_command .$$1345 \rm /tmp/out_command .$$1361 cat /tmp/out_command_${LOGIN}.$$ 1362 \rm /tmp/out_command_${LOGIN}.$$ 1346 1363 IGCM_debug_Exit "IGCM_sys_GetBuffer" 1347 1364 else 1348 \rm /tmp/out_command .$$1365 \rm /tmp/out_command_${LOGIN}.$$ 1349 1366 fi 1350 1367 fi … … 1362 1379 if ( $DEBUG_sys ) ; then 1363 1380 echo "IGCM_sys_GetDate_FichWork :" $@ 1381 fi 1382 1383 if [ $# -ge 3 ] ; then 1384 mode=$3 1385 TimeStyle=$4 1386 else 1387 mode="default" 1388 TimeStyle="%Y%m%d%H%M%S" 1389 fi 1390 1391 typeset dateF 1392 set +A dateF -- $( ls -l --full-time --time-style=+"${TimeStyle}" ${1} ) 1393 1394 case $mode in 1395 "default") 1396 eval ${2}=${dateF[5]} 1397 ;; 1398 "SplitFields") 1399 eval ${2}="${dateF[5]}\ ${dateF[6]}" 1400 ;; 1401 esac 1402 1403 1404 # donne la date filesys d'un fichier sur la machine work 1405 IGCM_debug_PopStack "IGCM_sys_FichWork" 1406 } 1407 1408 #D-#================================================== 1409 #D-function IGCM_sys_GetDate_FichArchive 1410 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1411 #D-* Examples: 1412 #D- 1413 function IGCM_sys_GetDate_FichArchive { 1414 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 1415 if ( $DEBUG_sys ) ; then 1416 echo "IGCM_sys_GetDate_FichArchive :" $@ 1364 1417 fi 1365 1418 typeset dateF … … 1367 1420 eval ${2}=${dateF[5]} 1368 1421 1369 # donne la date filesys d'un fichier sur la machine work1370 IGCM_debug_PopStack "IGCM_sys_FichWork"1371 }1372 1373 #D-#==================================================1374 #D-function IGCM_sys_GetDate_FichArchive1375 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE1376 #D-* Examples:1377 #D-1378 function IGCM_sys_GetDate_FichArchive {1379 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@1380 if ( $DEBUG_sys ) ; then1381 echo "IGCM_sys_GetDate_FichArchive :" $@1382 fi1383 typeset dateF1384 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )1385 eval ${2}=${dateF[5]}1386 1387 1422 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1423 } 1424 1425 #D-#================================================== 1426 #D-function IGCM_sys_GetDate_Monitoring 1427 #D-* Purpose: get the last year for which the monitoring has been computed 1428 #D-* Examples: 1429 #D- 1430 function IGCM_sys_GetDate_Monitoring { 1431 IGCM_debug_PushStack "IGCM_sys_GetDate_Monitoring" $@ 1432 if ( $DEBUG_sys ) ; then 1433 echo "IGCM_sys_GetDate_Monitoring :" $@ 1434 fi 1435 1436 eval ${2}=$( cdo showyear ${1} 2> /dev/null | gawk '{ print $NF }' ) 1437 1438 IGCM_debug_PopStack "IGCM_sys_GetDate_Monitoring" 1388 1439 } 1389 1440 … … 1537 1588 # 0 118 110.0000000000000 87.46478873239437 1538 1589 # 1 40 4.999999999999995 51.97183098591550 1590 1539 1591 # typeset iStation iProc list_opt file_in file_out prefix_invert 1540 1592 # typeset -Z4 j4 … … 1904 1956 EXECUTION="time ./script_${ExeNameOut}.ksh" 1905 1957 fi 1958 1959 IGCM_debug_Print 1 "sys $( hostname ) : script_${ExeNameOut}.ksh contains" 1960 cat script_${ExeNameOut}.ksh 1961 1906 1962 fi 1907 1963 done … … 1984 2040 i=0 1985 2041 while [ $i -lt $NB_ESSAI ] ; do 1986 ncap2 -C "$@" > /tmp/out_command .$$ 2>&12042 ncap2 -C "$@" > /tmp/out_command_${LOGIN}.$$ 2>&1 1987 2043 status=$? 1988 2044 if [ ${status} -gt 0 ] ; then 1989 2045 IGCM_debug_Print 2 "IGCM_sys_ncap2 : error code ${status}" 1990 cat /tmp/out_command .$$1991 \rm /tmp/out_command .$$2046 cat /tmp/out_command_${LOGIN}.$$ 2047 \rm /tmp/out_command_${LOGIN}.$$ 1992 2048 IGCM_debug_Print 2 "IGCM_sys_ncap2 : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 1993 2049 sleep $DELAI 1994 2050 else 1995 \rm /tmp/out_command .$$2051 \rm /tmp/out_command_${LOGIN}.$$ 1996 2052 break 1997 2053 fi … … 2026 2082 i=0 2027 2083 while [ $i -lt $NB_ESSAI ] ; do 2028 ncatted "$@" > /tmp/out_command .$$ 2>&12084 ncatted "$@" > /tmp/out_command_${LOGIN}.$$ 2>&1 2029 2085 status=$? 2030 2086 if [ ${status} -gt 0 ] ; then 2031 2087 IGCM_debug_Print 2 "IGCM_sys_ncatted : error code ${status}" 2032 cat /tmp/out_command .$$2033 \rm /tmp/out_command .$$2088 cat /tmp/out_command_${LOGIN}.$$ 2089 \rm /tmp/out_command_${LOGIN}.$$ 2034 2090 IGCM_debug_Print 2 "IGCM_sys_ncatted : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 2035 2091 sleep $DELAI 2036 2092 else 2037 \rm /tmp/out_command .$$2093 \rm /tmp/out_command_${LOGIN}.$$ 2038 2094 break 2039 2095 fi … … 2068 2124 i=0 2069 2125 while [ $i -lt $NB_ESSAI ] ; do 2070 ncbo -C $@ > /tmp/out_command .$$ 2>&12126 ncbo -C $@ > /tmp/out_command_${LOGIN}.$$ 2>&1 2071 2127 status=$? 2072 2128 if [ ${status} -gt 0 ] ; then 2073 2129 IGCM_debug_Print 2 "IGCM_sys_ncbo : error code ${status}" 2074 cat /tmp/out_command .$$2075 \rm /tmp/out_command .$$2130 cat /tmp/out_command_${LOGIN}.$$ 2131 \rm /tmp/out_command_${LOGIN}.$$ 2076 2132 IGCM_debug_Print 2 "IGCM_sys_ncbo : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 2077 2133 sleep $DELAI 2078 2134 else 2079 \rm /tmp/out_command .$$2135 \rm /tmp/out_command_${LOGIN}.$$ 2080 2136 break 2081 2137 fi … … 2110 2166 i=0 2111 2167 while [ $i -lt $NB_ESSAI ] ; do 2112 ncdiff -C $@ > /tmp/out_command .$$ 2>&12168 ncdiff -C $@ > /tmp/out_command_${LOGIN}.$$ 2>&1 2113 2169 status=$? 2114 2170 if [ ${status} -gt 0 ] ; then 2115 2171 IGCM_debug_Print 2 "IGCM_sys_ncdiff : error code ${status}" 2116 cat /tmp/out_command .$$2117 \rm /tmp/out_command .$$2172 cat /tmp/out_command_${LOGIN}.$$ 2173 \rm /tmp/out_command_${LOGIN}.$$ 2118 2174 IGCM_debug_Print 2 "IGCM_sys_ncdiff : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 2119 2175 sleep $DELAI 2120 2176 else 2121 \rm /tmp/out_command .$$2177 \rm /tmp/out_command_${LOGIN}.$$ 2122 2178 break 2123 2179 fi … … 2152 2208 i=0 2153 2209 while [ $i -lt $NB_ESSAI ] ; do 2154 ncea -C $@ > /tmp/out_command .$$ 2>&12210 ncea -C $@ > /tmp/out_command_${LOGIN}.$$ 2>&1 2155 2211 status=$? 2156 2212 if [ ${status} -gt 0 ] ; then 2157 2213 IGCM_debug_Print 2 "IGCM_sys_ncea : error code ${status}" 2158 cat /tmp/out_command .$$2159 \rm /tmp/out_command .$$2214 cat /tmp/out_command_${LOGIN}.$$ 2215 \rm /tmp/out_command_${LOGIN}.$$ 2160 2216 IGCM_debug_Print 2 "IGCM_sys_ncea : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 2161 2217 sleep $DELAI 2162 2218 else 2163 \rm /tmp/out_command .$$2219 \rm /tmp/out_command_${LOGIN}.$$ 2164 2220 break 2165 2221 fi … … 2194 2250 i=0 2195 2251 while [ $i -lt $NB_ESSAI ] ; do 2196 ncecat -C $@ > /tmp/out_command .$$ 2>&12252 ncecat -C $@ > /tmp/out_command_${LOGIN}.$$ 2>&1 2197 2253 status=$? 2198 2254 if [ ${status} -gt 0 ] ; then 2199 2255 IGCM_debug_Print 2 "IGCM_sys_ncecat : error code ${status}" 2200 cat /tmp/out_command .$$2201 \rm /tmp/out_command .$$2256 cat /tmp/out_command_${LOGIN}.$$ 2257 \rm /tmp/out_command_${LOGIN}.$$ 2202 2258 IGCM_debug_Print 2 "IGCM_sys_ncecat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 2203 2259 sleep $DELAI 2204 2260 else 2205 \rm /tmp/out_command .$$2261 \rm /tmp/out_command_${LOGIN}.$$ 2206 2262 break 2207 2263 fi … … 2236 2292 i=0 2237 2293 while [ $i -lt $NB_ESSAI ] ; do 2238 ncflint -C $@ > /tmp/out_command .$$ 2>&12294 ncflint -C $@ > /tmp/out_command_${LOGIN}.$$ 2>&1 2239 2295 status=$? 2240 2296 if [ ${status} -gt 0 ] ; then 2241 2297 IGCM_debug_Print 2 "IGCM_sys_ncflint : error code ${status}" 2242 cat /tmp/out_command .$$2243 \rm /tmp/out_command .$$2298 cat /tmp/out_command_${LOGIN}.$$ 2299 \rm /tmp/out_command_${LOGIN}.$$ 2244 2300 IGCM_debug_Print 2 "IGCM_sys_ncflint : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 2245 2301 sleep $DELAI 2246 2302 else 2247 \rm /tmp/out_command .$$2303 \rm /tmp/out_command_${LOGIN}.$$ 2248 2304 break 2249 2305 fi … … 2278 2334 i=0 2279 2335 while [ $i -lt $NB_ESSAI ] ; do 2280 ncks -C $@ > /tmp/out_command .$$ 2>&12336 ncks -C $@ > /tmp/out_command_${LOGIN}.$$ 2>&1 2281 2337 status=$? 2282 2338 if [ ${status} -gt 0 ] ; then 2283 2339 IGCM_debug_Print 2 "IGCM_sys_ncks : error code ${status}" 2284 cat /tmp/out_command .$$2285 \rm /tmp/out_command .$$2340 cat /tmp/out_command_${LOGIN}.$$ 2341 \rm /tmp/out_command_${LOGIN}.$$ 2286 2342 IGCM_debug_Print 2 "IGCM_sys_ncks : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 2287 2343 sleep $DELAI 2288 2344 else 2289 \rm /tmp/out_command .$$2345 \rm /tmp/out_command_${LOGIN}.$$ 2290 2346 break 2291 2347 fi … … 2320 2376 i=0 2321 2377 while [ $i -lt $NB_ESSAI ] ; do 2322 ncpdq -C $@ > /tmp/out_command .$$ 2>&12378 ncpdq -C $@ > /tmp/out_command_${LOGIN}.$$ 2>&1 2323 2379 status=$? 2324 2380 if [ ${status} -gt 0 ] ; then 2325 2381 IGCM_debug_Print 2 "IGCM_sys_ncpdq : error code ${status}" 2326 cat /tmp/out_command .$$2327 \rm /tmp/out_command .$$2382 cat /tmp/out_command_${LOGIN}.$$ 2383 \rm /tmp/out_command_${LOGIN}.$$ 2328 2384 IGCM_debug_Print 2 "IGCM_sys_ncpdq : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 2329 2385 sleep $DELAI 2330 2386 else 2331 \rm /tmp/out_command .$$2387 \rm /tmp/out_command_${LOGIN}.$$ 2332 2388 break 2333 2389 fi … … 2362 2418 i=0 2363 2419 while [ $i -lt $NB_ESSAI ] ; do 2364 ncra -C $@ > /tmp/out_command .$$ 2>&12420 ncra -C $@ > /tmp/out_command_${LOGIN}.$$ 2>&1 2365 2421 status=$? 2366 2422 if [ ${status} -gt 0 ] ; then 2367 2423 IGCM_debug_Print 2 "IGCM_sys_ncra : error code ${status}" 2368 cat /tmp/out_command .$$2369 \rm /tmp/out_command .$$2424 cat /tmp/out_command_${LOGIN}.$$ 2425 \rm /tmp/out_command_${LOGIN}.$$ 2370 2426 IGCM_debug_Print 2 "IGCM_sys_ncra : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 2371 2427 sleep $DELAI 2372 2428 else 2373 \rm /tmp/out_command .$$2429 \rm /tmp/out_command_${LOGIN}.$$ 2374 2430 break 2375 2431 fi … … 2404 2460 i=0 2405 2461 while [ $i -lt $NB_ESSAI ] ; do 2406 ncrcat -C $@ > /tmp/out_command .$$ 2>&12462 ncrcat -C $@ > /tmp/out_command_${LOGIN}.$$ 2>&1 2407 2463 status=$? 2408 2464 if [ ${status} -gt 0 ] ; then 2409 2465 IGCM_debug_Print 2 "IGCM_sys_ncrcat : error code ${status}" 2410 cat /tmp/out_command .$$2411 \rm /tmp/out_command .$$2466 cat /tmp/out_command_${LOGIN}.$$ 2467 \rm /tmp/out_command_${LOGIN}.$$ 2412 2468 IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 2413 2469 sleep $DELAI 2414 elif [ ! "X$( grep "WARNING Intra-file non-monotonicity" /tmp/out_command .$$ )" = "X" ] ; then2470 elif [ ! "X$( grep "WARNING Intra-file non-monotonicity" /tmp/out_command_${LOGIN}.$$ )" = "X" ] ; then 2415 2471 IGCM_debug_Print 2 "IGCM_sys_ncrcat : WARNING Intra-file non-monotonicity" 2416 cat /tmp/out_command .$$2472 cat /tmp/out_command_${LOGIN}.$$ 2417 2473 # remove files having corrupted time axis 2418 2474 eval lastArg=\${$#} 2419 2475 IGCM_debug_Print 2 "IGCM_sys_ncrcat : Delete ${lastArg}" 2420 2476 \rm ${lastArg} 2421 \rm /tmp/out_command .$$2477 \rm /tmp/out_command_${LOGIN}.$$ 2422 2478 IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 2423 2479 sleep $DELAI 2424 2480 else 2425 \rm /tmp/out_command .$$2481 \rm /tmp/out_command_${LOGIN}.$$ 2426 2482 break 2427 2483 fi … … 2456 2512 i=0 2457 2513 while [ $i -lt $NB_ESSAI ] ; do 2458 ncrename $@ > /tmp/out_command .$$ 2>&12514 ncrename $@ > /tmp/out_command_${LOGIN}.$$ 2>&1 2459 2515 status=$? 2460 2516 if [ ${status} -gt 0 ] ; then 2461 2517 IGCM_debug_Print 2 "IGCM_sys_ncrename : error code ${status}" 2462 cat /tmp/out_command .$$2463 \rm /tmp/out_command .$$2518 cat /tmp/out_command_${LOGIN}.$$ 2519 \rm /tmp/out_command_${LOGIN}.$$ 2464 2520 IGCM_debug_Print 2 "IGCM_sys_ncrename : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 2465 2521 sleep $DELAI 2466 2522 else 2467 \rm /tmp/out_command .$$2523 \rm /tmp/out_command_${LOGIN}.$$ 2468 2524 break 2469 2525 fi … … 2498 2554 i=0 2499 2555 while [ $i -lt $NB_ESSAI ] ; do 2500 ncwa -C $@ > /tmp/out_command .$$ 2>&12556 ncwa -C $@ > /tmp/out_command_${LOGIN}.$$ 2>&1 2501 2557 status=$? 2502 2558 if [ ${status} -gt 0 ] ; then 2503 2559 IGCM_debug_Print 2 "IGCM_sys_ncwa : error code ${status}" 2504 cat /tmp/out_command .$$2505 \rm /tmp/out_command .$$2560 cat /tmp/out_command_${LOGIN}.$$ 2561 \rm /tmp/out_command_${LOGIN}.$$ 2506 2562 IGCM_debug_Print 2 "IGCM_sys_ncwa : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." 2507 2563 sleep $DELAI 2508 2564 else 2509 \rm /tmp/out_command .$$2565 \rm /tmp/out_command_${LOGIN}.$$ 2510 2566 break 2511 2567 fi … … 2537 2593 typeset status 2538 2594 2539 \cdo $@ > /tmp/out_command .$$ 2>&12595 \cdo $@ > /tmp/out_command_${LOGIN}.$$ 2>&1 2540 2596 status=$? 2541 2597 if [ ${status} -gt 0 ] ; then 2542 2598 echo "IGCM_sys_cdo : error code ${status}" 2543 cat /tmp/out_command .$$2544 \rm /tmp/out_command .$$2599 cat /tmp/out_command_${LOGIN}.$$ 2600 \rm /tmp/out_command_${LOGIN}.$$ 2545 2601 IGCM_debug_PopStack "IGCM_sys_cdo" 2546 2602 return 1 -
trunk/libIGCM/libIGCM_sys/libIGCM_sys_obelix.ksh
r1163 r1178 213 213 function IGCM_sys_RshMaster { 214 214 IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 215 /bin/ksh 215 /bin/ksh <<-EOF 216 216 export libIGCM=${libIGCM} 217 217 export DEBUG_debug=${DEBUG_debug} … … 246 246 247 247 #D-#================================================== 248 #D-function IGCM_sys_RshArchive_NoError 249 #D-* Purpose: Archive rsh command, without error 250 #D-* used only in monitoring.job 251 #D-* Examples: 252 #D- 253 function IGCM_sys_RshArchive_NoError { 254 IGCM_debug_PushStack "IGCM_sys_RshArchive_NoError" $@ 255 /bin/ksh <<-EOF 256 ${@} 2> \dev\null 257 EOF 258 IGCM_debug_PopStack "IGCM_sys_RshArchive_NoError" 259 } 260 261 #D-#================================================== 248 262 #D-function IGCM_sys_RshPost 249 263 #D-* Purpose: Post-process rsh command … … 255 269 echo "IGCM_sys_RshPost :" $@ 256 270 fi 257 258 271 # keep standard input (stdin) for the loop onto temporary file 259 cat >tmp_IGCM_sys_RshPost_$$ 260 261 # ============ FRONTEND START ============ # 262 263 /bin/ksh <tmp_IGCM_sys_RshPost_$$ 272 cat >/tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 273 274 /bin/ksh </tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 264 275 if [ $? -gt 0 ] ; then 265 276 echo "IGCM_sys_RshPost : erreur." … … 267 278 fi 268 279 # delete temporary file 269 \rm tmp_IGCM_sys_RshPost_$$280 \rm /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 270 281 IGCM_debug_PopStack "IGCM_sys_RshPost" 271 282 } … … 299 310 300 311 if [ ! -z ${config_UserChoices_MailName} ] ; then 301 mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < mail.txt312 mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < mail.txt 302 313 elif [ -f ~/.forward ] ; then 303 314 mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < mail.txt … … 347 358 #- creation de repertoire sur le serveur fichier 348 359 if [ ! -d ${1} ]; then 349 mkdir -p $1360 \mkdir -p $1 350 361 status=$? 351 362 … … 930 941 fi 931 942 if [ $DRYRUN = 0 ]; then 932 if [ ! -d ${1} ] ; then933 echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."934 IGCM_debug_PopStack "IGCM_sys_Get_Dir"935 return936 fi937 938 943 typeset status 939 944 … … 1026 1031 typeset status 1027 1032 # 1028 if [ X${JobType} = XRUN ] ; then 1029 IGCM_sys_Chmod 444 ${1} 1030 fi 1031 # 1032 # Only if we use rsync 1033 #IGCM_sys_MkdirArchive $( dirname $2 ) 1034 # 1035 #USUAL WAY 1036 \cp $1 $2 > /tmp/out_command_${LOGIN}.$$ 2>&1 1033 # USUAL WAY 1034 \cp $1 $2 > /tmp/out_command.$$ 2>&1 1037 1035 status=$? 1038 1036 … … 1053 1051 if [ ${status} -gt 0 ] ; then 1054 1052 echo "IGCM_sys_Put_Rest : cp failed error code ${status}" 1055 cat /tmp/out_command_${LOGIN}.$$ 1053 [ -f ${1} ] && ls -l ${1} 1054 [ -f ${2} ] && ls -l ${2} 1055 [ -f ${2}/${1} ] && ls -l ${2}/${1} 1056 cat /tmp/out_command.$$ 1056 1057 IGCM_debug_Exit "IGCM_sys_Put_Rest" 1057 1058 else 1058 \rm /tmp/out_command_${LOGIN}.$$ 1059 1060 if [ X${JobType} = XRUN ] ; then 1061 [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} 1062 [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} 1063 fi 1064 1065 \rm /tmp/out_command.$$ 1059 1066 fi 1060 1067 fi … … 1080 1087 1081 1088 typeset status 1082 #1083 if [ X${JobType} = XRUN ] ; then1084 IGCM_sys_Chmod 444 ${1}1085 fi1086 1087 1089 # 1088 1090 # USUAL WAY … … 1097 1099 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 1098 1100 else 1099 \rm /tmp/out_command_${LOGIN}.$$ 1101 1102 if [ X${JobType} = XRUN ] ; then 1103 [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} 1104 [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} 1105 fi 1106 1107 \rm /tmp/out_command.$$ 1100 1108 fi 1101 1109 fi … … 1213 1221 i=0 1214 1222 while [ $i -lt $NB_ESSAI ] ; do 1215 # USUAL WAY 1216 \cp $1 $2 > /tmp/out_command_${LOGIN}.$$ 2>&1 1217 status=$? 1223 if [ $( stat -c %d $1 ) -ne $( stat -c %d $( dirname $2 ) ) ] ; then 1224 # USUAL WAY 1225 \cp $1 $2 > /tmp/out_command.$$ 2>&1 1226 status=$? 1227 else 1228 # NOT SO USUAL WAY 1229 \mv $1 $2 > /tmp/out_command.$$ 2>&1 1230 status=$? 1231 fi 1218 1232 if [ ${status} -gt 0 ]; then 1219 1233 IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" … … 1233 1247 [ -f ${2} ] && ls -l ${2} 1234 1248 [ -f ${2}/${1} ] && ls -l ${2}/${1} 1235 cat /tmp/out_command _${LOGIN}.$$1249 cat /tmp/out_command.$$ 1236 1250 IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 1237 1251 else … … 1387 1401 echo "IGCM_sys_GetDate_FichWork :" $@ 1388 1402 fi 1403 1404 if [ $# -ge 3 ] ; then 1405 mode=$3 1406 TimeStyle=$4 1407 else 1408 mode="default" 1409 TimeStyle="%Y%m%d%H%M%S" 1410 fi 1411 1389 1412 typeset dateF 1390 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1391 eval ${2}=${dateF[5]} 1413 set +A dateF -- $( ls -l --full-time --time-style=+"${TimeStyle}" ${1} ) 1414 1415 case $mode in 1416 "default") 1417 eval ${2}=${dateF[5]} 1418 ;; 1419 "SplitFields") 1420 eval ${2}="${dateF[5]}\ ${dateF[6]}" 1421 ;; 1422 esac 1423 1392 1424 1393 1425 # donne la date filesys d'un fichier sur la machine work … … 1577 1609 # 0 118 110.0000000000000 87.46478873239437 1578 1610 # 1 40 4.999999999999995 51.97183098591550 1611 1579 1612 # typeset iStation iProc list_opt file_in file_out prefix_invert 1580 1613 # typeset -Z4 j4
Note: See TracChangeset
for help on using the changeset viewer.