| 1 | #!/bin/sh -xvf
 | 
|---|
| 2 | DATE=/bin/date
 | 
|---|
| 3 | GREP=/bin/grep
 | 
|---|
| 4 | AWK=/bin/awk
 | 
|---|
| 5 | ECHO=/bin/echo
 | 
|---|
| 6 | WC=/usr/bin/wc
 | 
|---|
| 7 | CAT=/bin/cat
 | 
|---|
| 8 | PRINTF=/usr/bin/printf
 | 
|---|
| 9 | FIND=/usr/bin/find
 | 
|---|
| 10 | MKDIR=/bin/mkdir
 | 
|---|
| 11 | XARGS=/usr/bin/xargs
 | 
|---|
| 12 | SORT=/bin/sort
 | 
|---|
| 13 | RM=/bin/rm
 | 
|---|
| 14 | TR=/usr/bin/tr
 | 
|---|
| 15 | CP=/bin/cp
 | 
|---|
| 16 | LS=/bin/ls
 | 
|---|
| 17 | CHMOD=/bin/chmod
 | 
|---|
| 18 | 
 | 
|---|
| 19 | #Process cmd line args: the -src option is mandatory (source name as Abell85)
 | 
|---|
| 20 | sourceRadio=
 | 
|---|
| 21 | while [ $# -gt 0 ]
 | 
|---|
| 22 | do
 | 
|---|
| 23 |   case "$1" in
 | 
|---|
| 24 |       -src)  sourceRadio=$2; shift;;
 | 
|---|
| 25 |         -h)
 | 
|---|
| 26 |             echo >&2 \
 | 
|---|
| 27 |             "usage: $0 -src souce"
 | 
|---|
| 28 |             exit 1;;
 | 
|---|
| 29 |         *)  break;;     # terminate while loop
 | 
|---|
| 30 |     esac
 | 
|---|
| 31 |     shift
 | 
|---|
| 32 | done
 | 
|---|
| 33 | 
 | 
|---|
| 34 | #Path to public backupable path
 | 
|---|
| 35 | publicpath="/afs/in2p3.fr/home/c/campagne/public"
 | 
|---|
| 36 | 
 | 
|---|
| 37 | 
 | 
|---|
| 38 | #temporary files to synchronize scripts
 | 
|---|
| 39 | tmppublicpath=${TMPPUBLICPATH}
 | 
|---|
| 40 | $LS -l ${tmppublicpath} > /dev/null
 | 
|---|
| 41 | 
 | 
|---|
| 42 | #Path of the utility scripts
 | 
|---|
| 43 | scriptpath="/afs/in2p3.fr/home/c/campagne/private/work/AmasNancay"
 | 
|---|
| 44 | 
 | 
|---|
| 45 | #JEC 1/10/11 Use generic baodaqstatus name 
 | 
|---|
| 46 | #the daq current irod status
 | 
|---|
| 47 | #tag=`${DATE} +%F`
 | 
|---|
| 48 | #OUT1=${publicpath}/baodaqstatus-${tag}.txt
 | 
|---|
| 49 | OUT1=${publicpath}/baodaqstatus-current.txt
 | 
|---|
| 50 | 
 | 
|---|
| 51 | if [ ! -e ${OUT1}  -o ! -r ${OUT1} ]; then
 | 
|---|
| 52 |     $ECHO "FATAL (${scriptName}): ${OUT1} has a problem"
 | 
|---|
| 53 |     exit 1
 | 
|---|
| 54 | #    $ECHO "We should bring the DAQ status more up to date, this take 1 or 2sec..."
 | 
|---|
| 55 | #    $RM -f ${tmppublicpath}/statusdaq.finished
 | 
|---|
| 56 | #    ${scriptpath}/statusdaq.sh > ${OUT1}
 | 
|---|
| 57 | #    while [ ! -f "${tmppublicpath}/statusdaq.finished" ]; do
 | 
|---|
| 58 | #       sleep 30
 | 
|---|
| 59 | #    done
 | 
|---|
| 60 | #    $RM ${tmppublicpath}/statusdaq.finished
 | 
|---|
| 61 | #protect against remove/rewriting    
 | 
|---|
| 62 | #    $CHMOD -v 444 ${OUT1} 
 | 
|---|
| 63 | fi
 | 
|---|
| 64 | 
 | 
|---|
| 65 | jobBatchName="scaMaker-$sourceRadio"
 | 
|---|
| 66 | jobLogName="${jobBatchName}.log.$$"
 | 
|---|
| 67 | 
 | 
|---|
| 68 | qsub -l u_sps_baoradio,u_irods,T=100000,M=256MB,scratch=700MB,platform=LINUX -eo -o $jobLogName -N $jobBatchName -mb -me -mu campagne@lal.in2p3.fr <<EOF
 | 
|---|
| 69 | /afs/in2p3.fr/home/c/campagne/private/work/AmasNancay/scaextractor.sh  $sourceRadio
 | 
|---|
| 70 | EOF
 | 
|---|