source: TOOLS/PACK_IPSL/create_pack_list_with_bad_files.sh @ 2120

Last change on this file since 2120 was 2120, checked in by acosce, 8 years ago

Add to script to debug some problems create by pack_ipsl :
Somes files with name as *JobName?* (instead of JobName?*) were packed
So these scripts look for all these files and find in which pack they are.

File size: 2.9 KB
Line 
1#!/bin/bash
2# After find_bad_files_in_pack we have a list for each simulation with
3# files unexpected in pack. Now for all these files we will find in
4# which pack we stored them
5#
6# output = List_BadFile_$LOGIN.txt
7# syntax ::  pack name -->  file name.
8#
9
10LISTE_LOGIN=$SCRATCHDIR/pack_ipsl_logs/liste_login_debug.txt
11
12IGCM_TMP=$SCRATCHDIR/TMP_PACK
13mkdir -p ${IGCM_TMP}
14rm -rf ${IGCM_TMP}/*
15
16cd ${IGCM_TMP}
17for LOGIN in `awk  '{print $0}' ${LISTE_LOGIN}` ; do 
18#LOGIN=p86caub
19    ls -l $SCRATCHDIR/SAVE_PACK/$LOGIN > ${IGCM_TMP}/${$}.liste1.txt
20   
21
22    listSimu=`awk '{print $9}'  ${IGCM_TMP}/${$}.liste1.txt`
23    echo "${listSimu}" >> ${IGCM_TMP}/${$}.liste.simu.txt
24    grep -v liste_simul ${IGCM_TMP}/${$}.liste.simu.txt > ${IGCM_TMP}/${$}.liste.simu.txt.tmp
25    mv ${IGCM_TMP}/${$}.liste.simu.txt.tmp ${IGCM_TMP}/${$}.liste.simu.txt
26    sed -i -e "s/.info_bug_pack_output.txt//g"  ${IGCM_TMP}/${$}.liste.simu.txt
27
28
29    for SIMU in `awk '{print $0}' ${IGCM_TMP}/${$}.liste.simu.txt` ; do
30        echo $SIMU
31        cp $SCRATCHDIR/SAVE_PACK/$LOGIN/${SIMU}.info_bug_pack_output.txt ${IGCM_TMP}/${$}.liste.tmp
32        sed -i -e "s%.*${LOGIN}%%g"  ${IGCM_TMP}/${$}.liste.tmp
33        sed -i -e "s%/${SIMU}/.*$%%g"  ${IGCM_TMP}/${$}.liste.tmp
34
35        little_path=`awk '{if (NR==1) print $0}' ${IGCM_TMP}/${$}.liste.tmp `
36        # on recupere le repertoire output_tar et output_ncrcat de cette simu
37        tar xf $SCRATCHDIR/pack_ipsl_logs/${LOGIN}.ipsl_logs.tgz ${LOGIN}/IGCM_DEM${little_path}/${SIMU}/output_ncrcat
38        tar xf $SCRATCHDIR/pack_ipsl_logs/${LOGIN}.ipsl_logs.tgz ${LOGIN}/IGCM_DEM${little_path}/${SIMU}/output_tar
39
40
41       
42        for file in `awk '{print $2}'  $SCRATCHDIR/SAVE_PACK/$LOGIN/${SIMU}.info_bug_pack_output.txt`; do
43            BadFile=`grep  $file $LOGIN/IGCM_DEM${little_path}/${SIMU}/output_ncrcat/*list`
44            if [[ $BadFile != "" ]]; then
45                echo  "(.nc)" ${BadFile} >> $SCRATCHDIR/SAVE_PACK/$LOGIN/List_BadFile_$LOGIN.txt
46            fi
47            BadFile=`grep  $file $LOGIN/IGCM_DEM${little_path}/${SIMU}/output_tar/*list`
48            if [[ $BadFile != "" ]]; then
49                echo "(.tar)"  ${BadFile} >> $SCRATCHDIR/SAVE_PACK/$LOGIN/List_BadFile_$LOGIN.txt
50            fi
51        done
52       
53    done
54    sed -i -e "s%IGCM_DEM%dmf_import%g"  $SCRATCHDIR/SAVE_PACK/$LOGIN/List_BadFile_$LOGIN.txt
55    sed -i -e '/(.tar)/ s%.list%.tar%g' $SCRATCHDIR/SAVE_PACK/$LOGIN/List_BadFile_$LOGIN.txt
56    sed -i -e '/(.nc)/ s%.list%%g' $SCRATCHDIR/SAVE_PACK/$LOGIN/List_BadFile_$LOGIN.txt
57    sed -i -e "s% $LOGIN%/ccc/store/cont003/dsm/$LOGIN%g"  $SCRATCHDIR/SAVE_PACK/$LOGIN/List_BadFile_$LOGIN.txt
58    sed -i -e "s%output_ncrcat/%*/Output/*/%g"  $SCRATCHDIR/SAVE_PACK/$LOGIN/List_BadFile_$LOGIN.txt
59    sed -i -e "s%output_tar/%*/Output/*/%g"  $SCRATCHDIR/SAVE_PACK/$LOGIN/List_BadFile_$LOGIN.txt
60    sed -i -e "s%:% --> %g"  $SCRATCHDIR/SAVE_PACK/$LOGIN/List_BadFile_$LOGIN.txt
61    sed -i -e "s%(.tar)%%g" $SCRATCHDIR/SAVE_PACK/$LOGIN/List_BadFile_$LOGIN.txt
62    sed -i -e "s%(.nc)%%g" $SCRATCHDIR/SAVE_PACK/$LOGIN/List_BadFile_$LOGIN.txt
63
64
65done
Note: See TracBrowser for help on using the repository browser.