source: BAORadio/AmasNancay/trunk/statusdaq.sh @ 611

Last change on this file since 611 was 579, checked in by torrento, 13 years ago

version adaptee a grid engin (ana)

File size: 1.7 KB
Line 
1#!/bin/sh
2#liste des "sources" enregistrees sous Amas
3GREP=/bin/grep
4AWK=/bin/awk
5ECHO=/bin/echo
6MKDIR=/bin/mkdir
7CAT=/bin/cat
8PRINTF=/usr/bin/printf
9LS=/bin/ls
10RM=/bin/rm
11SORT=/bin/sort
12XARGS=/usr/bin/xargs
13DefaultIFS=$' \t\n'
14IFS=$DefaultIFS
15
16
17# Irods environment settings
18. /usr/local/shared/bin/irods_env.sh -noverbose
19
20scriptName="`basename $0`"
21$ECHO "Processing script ${scriptName} at `date`"
22
23#Path to public backupable path
24publicpath="/afs/in2p3.fr/home/c/campagne/public"
25
26
27#temporary files to synchronize scripts
28tmppublicpath=${TMPPUBLICPATH}
29$LS -l ${tmppublicpath} > /dev/null
30
31
32#Path where the job will do temporary IO
33. ${SCRIPTPATH}/set_iojobpath.sh
34iojobpath=$(set_iojobpath)
35cd ${iojobpath}
36
37
38OUT1=./baoils.$$
39ils /baoradio/data/AmasNancay/ > ${OUT1}
40OUT2=./baoawk1.$$
41$AWK '($1=="C-") {print $2}' ${OUT1} > ${OUT2}
42$RM $OUT1
43
44#Sequence
45tableau=( `$CAT $OUT2 | $AWK '{print $1}'` )
46IFS='
47'
48tableau=( $( $PRINTF "%s\n" "${tableau[@]}" | $AWK 'x[$0]++ == 0' ) )
49IFS=$DefaultIFS
50
51$RM $OUT2
52
53for i in ${tableau[@]}
54do
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
77done
78
79exit 0
Note: See TracBrowser for help on using the repository browser.