Changeset 717 for trunk/libIGCM/libIGCM_sys/libIGCM_sys_obelix.ksh
- Timestamp:
- 10/12/12 15:00:41 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.