source: BAORadio/AmasNancay/trunk/statusCycles.sh @ 579

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

version adaptee a grid engin (ana)

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/sh
2#liste des "sources" enregistrees sous Amas
3AWK=/bin/awk
4SED=/bin/sed
5GREP=/bin/grep
6WC=/usr/bin/wc
7RM=/bin/rm
8CAT=/bin/cat
9TOUCH=/bin/touch
10DATE=/bin/date
11ECHO=/bin/echo
12LS=/bin/ls
13MKDIR=/bin/mkdir
14TR=/usr/bin/tr
15FIND=/usr/bin/find
16PRINTF=/usr/bin/printf
17XARGS=/usr/bin/xargs
18SORT=/bin/sort
19QSUB=qsub
20
21DefaultIFS=$' \t\n'
22IFS=$DefaultIFS
23
24trim() { echo $1; }
25
26
27# Irods environment settings
28. /usr/local/shared/bin/irods_env.sh -noverbose
29
30scriptName="`basename $0`"
31$ECHO "Processing script ${scriptName} at `date`"
32
33#Path to public backupable path
34publicpath="/afs/in2p3.fr/home/c/campagne/public"
35
36
37#temporary files to synchronize scripts
38tmppublicpath=${TMPPUBLICPATH}
39$LS -l ${tmppublicpath} > /dev/null
40
41
42#Path where the job will do temporary IO
43. ${SCRIPTPATH}/set_iojobpath.sh
44iojobpath=$(set_iojobpath) 
45cd ${iojobpath}
46
47
48OUT1=./baoils.$$
49ils /baoradio/data/AmasNancay/ > ${OUT1}
50OUT2=./baoawk1.$$
51$AWK '($1=="C-") {print $2}' ${OUT1} > ${OUT2}
52$RM $OUT1
53#Sequence
54tableau=( `$CAT $OUT2 | $AWK '{print $1}'` )
55IFS='
56'
57tableau=( $( $PRINTF "%s\n" "${tableau[@]}" | $AWK 'x[$0]++ == 0' ) )
58IFS=$DefaultIFS
59
60$RM $OUT2
61
62for i in ${tableau[@]}
63do
64  OUT2=./baodir.$$
65  $ECHO "source $i"
66  listedate=( `ils $i | $AWK '($1=="C-"){print $2}'`)
67  IFS='
68'
69  listedate=( $( $PRINTF "%s\n" "${listedate[@]}" | $AWK 'x[$0]++ == 0' ) )
70  IFS=$DefaultIFS
71
72  for j in ${listedate[@]}
73  do
74    ils -l $j 2>&1 | $GREP -i "sca" > ${OUT2}
75#test if the SCA file has been already processed
76    scatrans=`$GREP -i "sca.*\.sum\.trans" ${OUT2} | $AWK '{print $NF}'`
77#test if the file is empty due to previous processing dysfunction
78    emptyfile=`$GREP -i "sca.*\.sum\.trans" ${OUT2} | $AWK '{print $4}'`
79#  echo "scrutinize directory <$i>: [$nblines] [$scatrans]"
80    if [ "<${scatrans}>" != "<>" ]; then
81        scafile=`$GREP -i "sca.*\.sum\.trans" ${OUT2} | $AWK '{print $NF}'`
82        if [ "<${scafile}>" = "<>" ]; then
83            $ECHO "WARNING (${scriptName}): Cannot download a SCA file for $j"
84        else
85#get sca file
86            iget -r -f -K ${j}/${scafile}
87            ncycle=`$CAT ${scafile} | $WC -l`
88            $RM ${scafile}
89            $ECHO ">>> $j ---> ${ncycle} cycles"
90        fi
91    else
92        $ECHO ">>> $j ---> NO SCA summary"
93    fi
94  done 
95  $RM ${OUT2}
96done
97
98
99
Note: See TracBrowser for help on using the repository browser.