source: BAORadio/AmasNancay/statusgain.sh @ 507

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

New import

File size: 1.5 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
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
44tableau=( `$CAT $OUT2 | $AWK '{print $1}'` )
45IFS='
46'
47tableau=( $( $PRINTF "%s\n" "${tableau[@]}" | $AWK 'x[$0]++ == 0' ) )
48IFS=$DefaultIFS
49
50$RM $OUT2
51
52for i in ${tableau[@]}
53do
54  $ECHO "source $i"
55  listedate=( `ils $i | $AWK '($1=="C-"){print $2}'`)
56  IFS='
57'
58  listedate=( $( $PRINTF "%s\n" "${listedate[@]}" | $AWK 'x[$0]++ == 0' ) )
59  IFS=$DefaultIFS
60
61  for j in ${listedate[@]}
62  do
63    gainOk=`ils ${j} | $GREP -i "gain_" | $WC -l`
64    if [ ${gainOk} -gt 0 ]; then
65        $ECHO ">>> $j ---> GAIN Done (${gainOk})"
66    else
67        $ECHO ">>> $j ---> GAIN To be computed"
68    fi
69  done 
70done
Note: See TracBrowser for help on using the repository browser.