source: BAORadio/AmasNancay/statusdaq.sh @ 535

Last change on this file since 535 was 516, checked in by campagne, 13 years ago

change the tmppubicpath (jec)

File size: 2.0 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
33if [ ${ENVIRONMENT} == "INTERACTIVE" ]; then
34    iojobpath="/sps/baoradio/AmasNancay/JEC"
35    $MKDIR -p $iojobpath
36elif [ ${ENVIRONMENT} == "BATCH" ] ; then
37    iojobpath=${TMPBATCH}
38else
39    $ECHO "FATAL (${scriptName}): environment is ${ENVIRONMENT} not allowed"
40    touch ${tmppublicpath}/statusdaq.finished
41    exit 1
42fi
43cd ${iojobpath}
44
45
46OUT1=./baoils.$$
47ils /baoradio/data/AmasNancay/ > ${OUT1}
48OUT2=./baoawk1.$$
49$AWK '($1=="C-") {print $2}' ${OUT1} > ${OUT2}
50$RM $OUT1
51
52#Sequence
53tableau=( `$CAT $OUT2 | $AWK '{print $1}'` )
54IFS='
55'
56tableau=( $( $PRINTF "%s\n" "${tableau[@]}" | $AWK 'x[$0]++ == 0' ) )
57IFS=$DefaultIFS
58
59$RM $OUT2
60
61for i in ${tableau[@]}
62do
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
85done
86
87touch ${tmppublicpath}/statusdaq.finished
88exit 0
Note: See TracBrowser for help on using the repository browser.