source: BAORadio/AmasNancay/trunk/submit2bqs-rawonoffmaker.sh @ 552

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

move to trunk the previous HEAD (jec)

  • Property svn:executable set to *
File size: 3.5 KB
Line 
1#!/bin/sh -xv
2AWK=/bin/awk
3SED=/bin/sed
4GREP=/bin/grep
5WC=/usr/bin/wc
6RM=/bin/rm
7CAT=/bin/cat
8TOUCH=/bin/touch
9DATE=/bin/date
10ECHO=/bin/echo
11LS=/bin/ls
12MKDIR=/bin/mkdir
13TR=/usr/bin/tr
14FIND=/usr/bin/find
15PRINTF=/usr/bin/printf
16XARGS=/usr/bin/xargs
17SORT=/bin/sort
18QSUB=qsub
19
20DefaultIFS=$' \t\n'
21IFS=$DefaultIFS
22
23
24scriptName="`basename $0`"
25echo "Processing script ${scriptName} at `date`"
26
27#Process cmd line args: the -src option is mandatory (source name as Abell85)
28sourceRadio=
29dateSelected=
30typeofproc=
31#first and last cycle to process
32#
33firstCycle=
34lastCycle=
35#use -sim option to simulate processing (debug the script as if...)
36simulationMode=""
37while [ $# -gt 0 ]
38do
39  case "$1" in
40      -src)  sourceRadio="$2"; shift;;
41      -date) dateSelected="-date $2"; dateJob="$2";     shift;;
42      -type) typeofproc="-type $2"; type=$2; shift;;
43      -fcycle) firstCycle="-fcycle $2"; fcycle="$2"; shift;;
44      -lcycle) lastCycle="-lcycle $2"; lcycle="$2"; shift;;
45       -sim) 
46      simulationMode="-sim On"
47      $ECHO "INFO ${scriptName} running in SIMUL mode";;
48        -h)
49        echo >&2 \
50            "usage: $0 -src souce -date YYYYMMDD -type type [-fcycle firstCycle] [-lcycle lastCycle] [-sim to trig simulation mode]"
51        exit 1;;
52        *)  break;;     # terminate while loop
53    esac
54    shift
55done
56
57if [ "<${sourceRadio}>" = "<>" ]; then
58    $ECHO "FATAL: You have forgotten to select the source option (-src)"
59    exit 1
60fi
61
62if [ "<${dateSelected}>" = "<>" ]; then
63    $ECHO "FATAL: You have forgotten to select the date option (-date)"
64    exit 1
65fi
66
67if [ "<${typeofproc}>" = "<>" ]; then
68    $ECHO "FATAL: You have forgotten to select the type option (-type)"
69    exit 1
70fi
71
72#Path to public backupable path
73publicpath="/afs/in2p3.fr/home/c/campagne/public"
74#temporary files to synchronize scripts
75tmppublicpath=${TMPPUBLICPATH}
76#Path of the utility scripts
77scriptpath="/afs/in2p3.fr/home/c/campagne/private/work/AmasNancay"
78#get the daq current irod status
79#JEC 1/10/11 Use generic baodaqstatus name
80#### tag=`${DATE} +%F`
81OUT1=${publicpath}/baodaqstatus-current.txt
82
83if [ ! -e ${OUT1}  -o ! -r ${OUT1} ]; then
84    $ECHO "FATAL (${scriptName}): ${OUT1} has a problem"
85    exit 1
86#JEC 29/9/11 avoid finished stuff
87#    $RM -f ${tmppublicpath}/statusdaq.finished
88#    ${scriptpath}/statusdaq.sh > ${OUT1}
89#    while [ ! -f "${tmppublicpath}/statusdaq.finished" ]; do
90#       sleep 30
91#    done
92#    $RM ${tmppublicpath}/statusdaq.finished
93#protect against remove/rewriting   
94#    $CHMOD -v 444 ${OUT1}
95fi
96
97#assume 20 files/cycles cf. 30sec/cycle et 3sec par signal et fact 2 margin
98if [ "<${firstCycle}>" != "<>" -a "<${lastCycle}>" != "<>" ]; then
99    jobBatchName="rawonoff-${sourceRadio}${dateJob}${type}-${fcycle}-${lcycle}"
100    nFiles=`expr ${lcycle} - ${fcycle} + 1`
101    nFiles=`expr ${nFiles} \* 20`
102else
103    jobBatchName="rawonoff-${sourceRadio}${dateJob}${type}-All"
104    #assume 30 cycles maxi!
105    nFiles="20 \* 30"
106
107fi
108
109jobLogName="${jobBatchName}.log.$$"
110
111#Nbre de paquets utilises pour 1 spectre
112tspwin="5120"
113#calcul du scratch sachant que l'on nettoie apres chaque cycle
114nSpectra=`expr 20 \* 25600 /  ${tspwin}`
115scratchSize=`expr  20 \* 500 + ${nSpectra} \* 200 / 1000 + 5`
116
117#le cpu total tient compte de l'emsemble des ficheirs a taiter
118cpu=`expr ${nFiles} \* 60 \* 50`
119
120qsub -l u_sps_baoradio,u_irods,T=${cpu},M=1000MB,scratch=${scratchSize}MB,platform=LINUX -eo -o $jobLogName -N $jobBatchName -mb -me -mu campagne@lal.in2p3.fr <<EOF
121/afs/in2p3.fr/home/c/campagne/private/work/AmasNancay/proc_rawonoff.sh  -src ${sourceRadio} ${dateSelected} ${typeofproc} ${firstCycle} ${lastCycle} ${simulationMode}
122EOF
Note: See TracBrowser for help on using the repository browser.