source: BAORadio/AmasNancay/v4/statusonoff.sh@ 607

Last change on this file since 607 was 548, checked in by campagne, 14 years ago

mv to trunk continued (jec)

  • Property svn:executable set to *
File size: 3.7 KB
Line 
1#!/bin/sh
2#Status de l'etat de la production des fichiers INPUT de calibrations
3GREP=/bin/grep
4AWK=/bin/awk
5ECHO=/bin/echo
6MKDIR=/bin/mkdir
7CAT=/bin/cat
8PRINTF=/usr/bin/printf
9RM=/bin/rm
10SORT=/bin/sort
11XARGS=/usr/bin/xargs
12WC=/usr/bin/wc
13DefaultIFS=$' \t\n'
14IFS=$DefaultIFS
15
16# Irods environment settings
17. /usr/local/shared/bin/irods_env.sh -noverbose
18
19scriptName="`basename $0`"
20$ECHO "Processing script ${scriptName} at `date`"
21
22#Path to public backupable path
23publicpath="/afs/in2p3.fr/home/c/campagne/public"
24
25#Path where the job will do temporary IO
26if [ ${ENVIRONMENT} == "INTERACTIVE" ]; then
27 iojobpath="/sps/baoradio/AmasNancay/JEC"
28 $MKDIR -p $iojobpath
29elif [ ${ENVIRONMENT} == "BATCH" ] ; then
30 iojobpath=${TMPBATCH}
31else
32 $ECHO "FATAL (${scriptName}): environment is ${ENVIRONMENT} not allowed"
33 exit 1
34fi
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#Sequence
44listeSources=( `$CAT $OUT2 | $AWK '{print $1}'` )
45IFS='
46'
47listeSources=( $( $PRINTF "%s\n" "${listeSources[@]}" | $AWK 'x[$0]++ == 0' ) )
48IFS=$DefaultIFS
49$RM $OUT2
50
51for i in ${listeSources[@]}
52do
53#nb: $i contains the full path
54 $ECHO "source ${i}"
55 sourceName=`basename ${i}`
56 listeDates=( `ils $i | $AWK '($1=="C-"){print $2}'`)
57 IFS='
58'
59 listeDates=( $( $PRINTF "%s\n" "${listeDates[@]}" | $AWK 'x[$0]++ == 0' ) )
60 IFS=$DefaultIFS
61
62 for j in ${listeDates[@]}
63 do
64#nb: $j contains the full path
65# $ECHO "run ${j}"
66#
67#Off directory
68#
69 dateField=`basename ${j}`
70 sourceDate="${sourceName}-${dateField}"
71#look if final data processing files exist
72 onOffOk=`ils ${j} | $GREP -i "data.*\.ppf\|diff.*\.ppf" | $WC -l`
73 offDirExist=`ils ${j} | $GREP -i "Off" | $WC -l`
74 if [ ${offDirExist} != 0 ]; then
75 listeCyclesOff=( `ils ${j}/Off | $GREP -i "datacycle" | $AWK '($1=="C-"){print $2}' | $XARGS -i basename {} | $SORT -k1.11n` )
76 IFS='
77 '
78 listeCyclesOff=( $( $PRINTF "%s\n" "${listeCyclesOff[@]}" | $AWK 'x[$0]++ == 0' ) )
79 IFS=$DefaultIFS
80
81 if [ ${#listeCyclesOff[*]} != 0 ]; then
82 for c in ${listeCyclesOff[@]}
83 do
84#nb: $c has the format of datacycle<number>
85 nFiles=`ils ${j}/Off/${c} | $GREP -i "medfiltmtx" | $WC -l`
86 if [ ${nFiles} != 0 ]; then
87 $ECHO "${sourceDate}/Off/${c}: ${nFiles} spectra (${onOffOk} ana)"
88 else
89 $ECHO "${sourceDate}/Off/${c}: ON-OFF failed"
90 fi
91#end of loop on cycles
92 done
93 else
94 $ECHO "${sourceDate} : No ON-OFF done for Off Diectory"
95 fi
96#end of Off exist
97 else
98 $ECHO "${sourceDate} : No Off Diectory"
99 fi
100#
101#On directory
102#
103 dateField=`basename ${j}`
104 sourceDate="${sourceName}-${dateField}"
105#look if final calibration files exist
106 onOnOk=`ils ${j} | $GREP -i "data.*\.ppf\|diff.*\.ppf" | $WC -l`
107 onDirExist=`ils ${j} | $GREP -i "On" | $WC -l`
108 if [ ${onDirExist} != 0 ]; then
109 listeCyclesOn=( `ils ${j}/On | $GREP -i "datacycle" | $AWK '($1=="C-"){print $2}' | $XARGS -i basename {} | $SORT -k1.11n` )
110 IFS='
111 '
112 listeCyclesOn=( $( $PRINTF "%s\n" "${listeCyclesOn[@]}" | $AWK 'x[$0]++ == 0' ) )
113 IFS=$DefaultIFS
114
115 if [ ${#listeCyclesOn[*]} != 0 ]; then
116 for c in ${listeCyclesOn[@]}
117 do
118#nb: $c has the format of datacycle<number>
119 nFiles=`ils ${j}/On/${c} | $GREP -i "medfiltmtx" | $WC -l`
120 if [ ${nFiles} != 0 ]; then
121 $ECHO "${sourceDate}/On/${c}: ${nFiles} spectra (${onOnOk} ana)"
122 else
123 $ECHO "${sourceDate}/On/${c}: ON-OFF failed"
124 fi
125#end of loop on cycles
126 done
127 else
128 $ECHO "${sourceDate} : No ON-OFF done for On Diectory"
129 fi
130#end of On exist
131 else
132 $ECHO "${sourceDate} : No On Diectory"
133 fi
134#end of loop on dates
135 done
136#end of loop on sources
137done
Note: See TracBrowser for help on using the repository browser.