[507] | 1 | #!/bin/sh |
---|
| 2 | #liste des "sources" enregistrees sous Amas |
---|
| 3 | GREP=/bin/grep |
---|
| 4 | AWK=/bin/awk |
---|
| 5 | ECHO=/bin/echo |
---|
| 6 | MKDIR=/bin/mkdir |
---|
| 7 | CAT=/bin/cat |
---|
| 8 | PRINTF=/usr/bin/printf |
---|
| 9 | LS=/bin/ls |
---|
| 10 | RM=/bin/rm |
---|
| 11 | SORT=/bin/sort |
---|
| 12 | XARGS=/usr/bin/xargs |
---|
| 13 | DefaultIFS=$' \t\n' |
---|
| 14 | IFS=$DefaultIFS |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | # Irods environment settings |
---|
| 18 | . /usr/local/shared/bin/irods_env.sh -noverbose |
---|
| 19 | |
---|
| 20 | scriptName="`basename $0`" |
---|
| 21 | $ECHO "Processing script ${scriptName} at `date`" |
---|
| 22 | |
---|
| 23 | #Path to public backupable path |
---|
| 24 | publicpath="/afs/in2p3.fr/home/c/campagne/public" |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | #temporary files to synchronize scripts |
---|
[516] | 28 | tmppublicpath=${TMPPUBLICPATH} |
---|
[507] | 29 | $LS -l ${tmppublicpath} > /dev/null |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | #Path where the job will do temporary IO |
---|
[579] | 33 | . ${SCRIPTPATH}/set_iojobpath.sh |
---|
| 34 | iojobpath=$(set_iojobpath) |
---|
[507] | 35 | cd ${iojobpath} |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | OUT1=./baoils.$$ |
---|
| 39 | ils /baoradio/data/AmasNancay/ > ${OUT1} |
---|
| 40 | OUT2=./baoawk1.$$ |
---|
| 41 | $AWK '($1=="C-") {print $2}' ${OUT1} > ${OUT2} |
---|
| 42 | $RM $OUT1 |
---|
| 43 | |
---|
| 44 | #Sequence |
---|
| 45 | tableau=( `$CAT $OUT2 | $AWK '{print $1}'` ) |
---|
| 46 | IFS=' |
---|
| 47 | ' |
---|
| 48 | tableau=( $( $PRINTF "%s\n" "${tableau[@]}" | $AWK 'x[$0]++ == 0' ) ) |
---|
| 49 | IFS=$DefaultIFS |
---|
| 50 | |
---|
| 51 | $RM $OUT2 |
---|
| 52 | |
---|
| 53 | for i in ${tableau[@]} |
---|
| 54 | do |
---|
| 55 | $ECHO "source $i" |
---|
| 56 | listedate=( `ils $i | $AWK '($1=="C-"){print $2}'`) |
---|
| 57 | IFS=' |
---|
| 58 | ' |
---|
| 59 | listedate=( $( $PRINTF "%s\n" "${listedate[@]}" | $AWK 'x[$0]++ == 0' ) ) |
---|
| 60 | IFS=$DefaultIFS |
---|
| 61 | |
---|
| 62 | ntotfiles=0 |
---|
| 63 | for j in ${listedate[@]} |
---|
| 64 | do |
---|
| 65 | #Nb: care should be taken to the possible instances of a file returned by ILS |
---|
| 66 | listOfsig=( `ils ${j}/Fiber1 | $GREP -i "signal" | $XARGS -i basename {} | $SORT -k1.7n` ) |
---|
| 67 | IFS=' |
---|
| 68 | ' |
---|
| 69 | listOfsig=( $( $PRINTF "%s\n" "${listOfsig[@]}" | $AWK 'x[$0]++ == 0' ) ) |
---|
| 70 | IFS=$DefaultIFS |
---|
| 71 | nfiles=${#listOfsig[@]} |
---|
| 72 | $ECHO ">>> $j ---> $nfiles" |
---|
| 73 | let "ntotfiles=ntotfiles+nfiles" |
---|
| 74 | done |
---|
| 75 | $ECHO "total files = $ntotfiles" |
---|
| 76 | |
---|
| 77 | done |
---|
| 78 | |
---|
| 79 | exit 0 |
---|