Changeset 2045 for TOOLS/PACK_IPSL/archive_debug.sh
- Timestamp:
- 04/05/13 17:34:38 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/PACK_IPSL/archive_debug.sh
r2027 r2045 95 95 96 96 ls -l ${STORE_DEBUG} > ${IGCM_TMP}/${$}.new_liste_debug_files.txt 97 98 99 #creation des listes en fonction des suffixes 100 if [ "x${ON_IDRIS}" == "xno" ] 101 then 102 awk '{if (NR >1) print $9}' ${IGCM_TMP}/${$}.new_liste_debug_files.txt > ${IGCM_TMP}/${$}.new_liste_debug_files.txt_tmp 103 else 104 awk '{if (NR >1) print $8}' ${IGCM_TMP}/${$}.new_liste_debug_files.txt > ${IGCM_TMP}/${$}.new_liste_debug_files.txt_tmp 105 fi 106 sort ${IGCM_TMP}/${$}.new_liste_debug_files.txt_tmp > ${IGCM_TMP}/${$}.order_new_liste_debug_files.txt 107 ref=`awk -F_ '{if (NR==1) print $1}' ${IGCM_TMP}/${$}.order_new_liste_debug_files.txt` 108 109 110 111 i=1 112 for new_file in `awk '{print $0}' ${IGCM_TMP}/${$}.order_new_liste_debug_files.txt`; do 113 new_ref=$( echo ${new_file} | sed -e "s/_.*//") 114 115 if [ ${new_ref} == ${ref} ]; then 116 echo ${new_file} >> ${IGCM_TMP}/${$}.debug_list_${i}.txt 117 else 118 ref=${new_ref} 119 (( i = $i + 1 )) 120 echo ${new_file} >> ${IGCM_TMP}/${$}.debug_list_${i}.txt 121 fi 122 done 123 124 j=1 125 while [[ $j -le $i ]]; do 126 127 97 128 ### 2- creer les listes de fichiers par periode #### 98 129 DEM_log -1 "Creation des listes de fichiers par periode" … … 100 131 date_begin=${DateBegin} 101 132 date_end=${DateEnd} 102 133 103 134 year_begin=$(echo ${date_begin} | cut -c 1-4 ) 104 135 month_begin=$(echo ${date_begin} | cut -c 5-6 ) … … 122 153 month_end_pack=${month_begin_pack} 123 154 year_end_pack=`expr ${year_begin_pack} + ${period_pack}` 124 155 125 156 date_end_pack=${year_end_pack}${month_end_pack}01 126 if [ "x${ON_IDRIS}" == "xno" ]127 then128 for file in `awk '{print $9}' ${IGCM_TMP}/${$}.new_liste_debug_files.txt`; do129 extract_date_file=`echo ${file} | sed -e "s/.*\${JobName}_//"`130 date_file=`echo ${extract_date_file}| sed 's/\([0-9]\{8\}\)_.*$/\1/g'`131 if [[ "x${date_file}" != "x" && ! -n ${date_file//[0-9]/} ]]; then132 if [ ${date_file} -lt ${date_end_pack} ]157 for file in `awk '{print $1}' ${IGCM_TMP}/${$}.debug_list_${j}.txt`; do 158 extract_date_file=`echo ${file} | sed -e "s/.*\${JobName}_//"` 159 date_file=`echo ${extract_date_file}| sed 's/\([0-9]\{8\}\)_.*$/\1/g'` 160 if [[ "x${date_file}" != "x" && ! -n ${date_file//[0-9]/} ]]; then 161 if [ ${date_file} -lt ${date_end_pack} ] 162 then 163 if [ ${date_file} -ge ${date_begin_pack} ] 133 164 then 134 if [ ${date_file} -ge ${date_begin_pack} ] 135 then 136 echo ${file} >> ${IGCM_TMP}/${$}.liste_pack_debug_${number_pack}.txt 137 fi 138 fi 139 fi 140 done 141 else 142 for file in `awk '{print $8}' ${IGCM_TMP}/${$}.new_liste_debug_files.txt`; do 143 extract_date_file=`echo ${file} | sed -e "s/.*\${JobName}_//"` 144 date_file=`echo ${extract_date_file}| sed 's/\([0-9]\{8\}\)_.*$/\1/g'` 145 if [[ "x${date_file}" != "x" && ! -n ${date_file//[0-9]/} ]]; then 146 if [ ${date_file} -lt ${date_end_pack} ] 147 then 148 if [ ${date_file} -ge ${date_begin_pack} ] 149 then 150 echo ${file} >> ${IGCM_TMP}/${$}.liste_pack_debug_${number_pack}.txt 151 fi 152 fi 153 fi 154 done 155 fi 165 echo ${file} >> ${IGCM_TMP}/${$}.liste_pack_debug_${number_pack}.txt 166 grep -v ${file} ${IGCM_TMP}/${$}.debug_list_${j}.txt > ${IGCM_TMP}/${$}.debug_list_${j}.txt.tmp 167 mv ${IGCM_TMP}/${$}.debug_list_${j}.txt.tmp ${IGCM_TMP}/${$}.debug_list_${j}.txt 168 169 fi 170 fi 171 fi 172 if [ ${date_file} -gt ${date_end_pack} ] 173 then 174 break 175 fi 176 177 done 178 month_begin_pack=${month_end_pack} 179 year_begin_pack=${year_end_pack} 180 181 date_begin_pack=${year_begin_pack}${month_begin_pack}01 182 183 number_pack=`expr ${number_pack} + 1` 184 done 185 186 ((j = $j + 1 )) 187 done 188 189 compt_pack=1 190 while [[ $compt_pack -le $number_pack ]]; do 191 156 192 #on archive les debug - le nom de l'archive contiendra ${yearbegin}${monthbegin}_${yearend}${monthend} 157 193 # end etant la date du dernier fichier contenu et non pas la premiere date suivant … … 159 195 #On classe par ordre alphabetique les fichiers contenus dans liste_pack_debug 160 196 #la date du dernier fichier donnera la date de fin du pack 161 if [[ -f ${IGCM_TMP}/${$}.liste_pack_debug_${ number_pack}.txt ]] ; then162 sort ${IGCM_TMP}/${$}.liste_pack_debug_${ number_pack}.txt > ${IGCM_TMP}/${$}.liste_pack_debug_${number_pack}.txt.tmp163 164 first_file=$(head -n 1 ${IGCM_TMP}/${$}.liste_pack_debug_${ number_pack}.txt.tmp )197 if [[ -f ${IGCM_TMP}/${$}.liste_pack_debug_${compt_pack}.txt ]] ; then 198 sort ${IGCM_TMP}/${$}.liste_pack_debug_${compt_pack}.txt > ${IGCM_TMP}/${$}.liste_pack_debug_${compt_pack}.txt.tmp 199 200 first_file=$(head -n 1 ${IGCM_TMP}/${$}.liste_pack_debug_${compt_pack}.txt.tmp ) 165 201 extract_date_file=$( echo ${first_file} | sed -e "s/.*${JobName}_//" ) 166 202 DateBegin_Debug=$(echo ${extract_date_file}| sed 's%\([0-9]\{8\}\)_.*$%\1%g' ) 167 203 168 last_file=$(tail -n 1 ${IGCM_TMP}/${$}.liste_pack_debug_${ number_pack}.txt.tmp )204 last_file=$(tail -n 1 ${IGCM_TMP}/${$}.liste_pack_debug_${compt_pack}.txt.tmp ) 169 205 extract_date_file=$( echo ${last_file} | sed -e "s/.*${JobName}_//" ) 170 206 DateEnd_Debug=$( echo ${extract_date_file}| sed 's%.*\([0-9]\{8\}\)_.*$%\1%g' ) 171 mv ${IGCM_TMP}/${$}.liste_pack_debug_${ number_pack}.txt.tmp ${DEBUG_TAR}/${JobName}_debug_${DateBegin_Debug}_${DateEnd_Debug}.list207 mv ${IGCM_TMP}/${$}.liste_pack_debug_${compt_pack}.txt.tmp ${DEBUG_TAR}/${JobName}_debug_${DateBegin_Debug}_${DateEnd_Debug}.list 172 208 fi 173 209 174 DEM_log -1 "Passage de la commande Tar pour archiver la liste creee"175 # tar -cf ${JobName}_${date_begin_pack}_${DateEnd_Debug}_debug.tar --dereference --files-from ${DEBUG_TAR}/tar_debug_${date_begin_pack}_${DateEnd_Debug}.list176 # cat ${DEBUG_TAR}/tar_debug_${number_pack}.list | xargs rm177 210 178 211 179 212 DEM_log -1 "On definit le datebegin de la prochaine periode pack" 180 213 #on definit la periode pack suivante 181 month_begin_pack=${month_end_pack} 182 year_begin_pack=${year_end_pack} 183 184 date_begin_pack=${year_begin_pack}${month_begin_pack}01 185 186 number_pack=`expr ${number_pack} + 1` 187 214 215 compt_pack=`expr ${compt_pack} + 1` 188 216 done 189 217
Note: See TracChangeset
for help on using the changeset viewer.