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 |
---|
28 | tmppublicpath="/sps/baoradio/AmasNancay" |
---|
29 | $LS -l ${tmppublicpath} > /dev/null |
---|
30 | |
---|
31 | |
---|
32 | #Path where the job will do temporary IO |
---|
33 | if [ ${ENVIRONMENT} == "INTERACTIVE" ]; then |
---|
34 | iojobpath="/sps/baoradio/AmasNancay/JEC" |
---|
35 | $MKDIR -p $iojobpath |
---|
36 | elif [ ${ENVIRONMENT} == "BATCH" ] ; then |
---|
37 | iojobpath=${TMPBATCH} |
---|
38 | else |
---|
39 | $ECHO "FATAL (${scriptName}): environment is ${ENVIRONMENT} not allowed" |
---|
40 | touch ${tmppublicpath}/statusdaq.finished |
---|
41 | exit 1 |
---|
42 | fi |
---|
43 | cd ${iojobpath} |
---|
44 | |
---|
45 | |
---|
46 | OUT1=./baoils.$$ |
---|
47 | ils /baoradio/data/AmasNancay/ > ${OUT1} |
---|
48 | OUT2=./baoawk1.$$ |
---|
49 | $AWK '($1=="C-") {print $2}' ${OUT1} > ${OUT2} |
---|
50 | $RM $OUT1 |
---|
51 | |
---|
52 | #Sequence |
---|
53 | tableau=( `$CAT $OUT2 | $AWK '{print $1}'` ) |
---|
54 | IFS=' |
---|
55 | ' |
---|
56 | tableau=( $( $PRINTF "%s\n" "${tableau[@]}" | $AWK 'x[$0]++ == 0' ) ) |
---|
57 | IFS=$DefaultIFS |
---|
58 | |
---|
59 | $RM $OUT2 |
---|
60 | |
---|
61 | for i in ${tableau[@]} |
---|
62 | do |
---|
63 | $ECHO "source $i" |
---|
64 | listedate=( `ils $i | $AWK '($1=="C-"){print $2}'`) |
---|
65 | IFS=' |
---|
66 | ' |
---|
67 | listedate=( $( $PRINTF "%s\n" "${listedate[@]}" | $AWK 'x[$0]++ == 0' ) ) |
---|
68 | IFS=$DefaultIFS |
---|
69 | |
---|
70 | ntotfiles=0 |
---|
71 | for j in ${listedate[@]} |
---|
72 | do |
---|
73 | #Nb: care should be taken to the possible instances of a file returned by ILS |
---|
74 | listOfsig=( `ils ${j}/Fiber1 | $GREP -i "signal" | $XARGS -i basename {} | $SORT -k1.7n` ) |
---|
75 | IFS=' |
---|
76 | ' |
---|
77 | listOfsig=( $( $PRINTF "%s\n" "${listOfsig[@]}" | $AWK 'x[$0]++ == 0' ) ) |
---|
78 | IFS=$DefaultIFS |
---|
79 | nfiles=${#listOfsig[@]} |
---|
80 | $ECHO ">>> $j ---> $nfiles" |
---|
81 | let "ntotfiles=ntotfiles+nfiles" |
---|
82 | done |
---|
83 | $ECHO "total files = $ntotfiles" |
---|
84 | |
---|
85 | done |
---|
86 | |
---|
87 | touch ${tmppublicpath}/statusdaq.finished |
---|
88 | exit 0 |
---|