/[PAMELA software]/productionkit/deamons/src/profilerdeamon.sh
ViewVC logotype

Annotation of /productionkit/deamons/src/profilerdeamon.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (download) (as text) (vendor branch)
Thu Nov 30 14:09:20 2006 UTC (18 years ago) by mocchiut
Branch: productionkit, MAIN
CVS Tags: start, v0r00, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: application/x-sh
Imported sources

1 mocchiut 1.1 #!/bin/bash
2    
3     source /gpfs/wizard/flight/production/installed/set_pam_env.sh > /dev/null 2>&1;
4    
5     if [ "$PAM_BIN" == "" ]; then exit; fi
6    
7     export PRODDIR=/gpfs/wizard/flight/production/
8    
9     export L0=$PRODDIR/level0/good/
10    
11     export CLN1=$PRODDIR/postRawreader/
12    
13     export WRKDIR=$PRODDIR/deamons/wrkdir/
14    
15     export SCRIPT=$PRODDIR/deamons/script/
16    
17     export LOGDIR=$PRODDIR/logs/
18    
19     export PAM_DBHOST=mysql://srv-g2-01.ts.infn.it/pamela
20     #export PAM_DBHOST=mysql://srv-g2-01.ts.infn.it/test
21     #export PAM_DBHOST=mysql://localhost/emitest?socket=`mysql_config --socket`
22    
23     export PAM_DBUSER=root
24    
25     export PAM_DBPSW=Calo0%Ts
26    
27     touch $WRKDIR/profiler.profilerlist
28    
29     LOG=$WRKDIR/profiler.log
30    
31     touch $LOG
32    
33     echo -n " YODAPROFILER DEAMON STARTED AT " >> $LOG;
34    
35     date >> $LOG;
36    
37     echo "300" > $WRKDIR/profiler.step
38    
39     TIME=`tail -1 $WRKDIR/profiler.step`;
40    
41     while [ $TIME -ne 0 ]; do
42    
43     ls $L0/*.root &> $WRKDIR/profiler.yodalist 2>/dev/null;
44    
45     for nfile in `sort $WRKDIR/profiler.yodalist`; do
46    
47     file=`basename $nfile`
48    
49     DONE=0;
50    
51     for procfile in `cat $WRKDIR/profiler.profilerlist`; do
52    
53     if [ $file == $procfile ]; then
54    
55     DONE=1;
56    
57     fi;
58    
59     done;
60    
61     while [ $DONE -eq 0 ]; do
62    
63     NOW=`date +%s`
64    
65     CTIME=`date --reference=$nfile +%s`
66    
67     let DELTA=NOW-CTIME
68    
69     while [ $DELTA -lt 300 ]; do
70    
71     echo "File $file is hot! waiting 59 seconds..." >> $LOG;
72    
73     sleep 59;
74    
75     NOW=`date +%s`
76    
77     CTIME=`date --reference=$nfile +%s`
78    
79     let DELTA=NOW-CTIME
80    
81     done;
82    
83     echo -n "FILE IS COLD NOW: " >> $LOG;
84    
85     date >> $LOG;
86    
87     echo "Processing file $file!" >> $LOG;
88    
89     R=0;
90    
91     if [ -s $L0/$file ]; then
92    
93     echo " File $file is on disk! " >> $LOG;
94    
95     else
96    
97     COPY="";
98    
99     echo " File not found on disk or empty! " >> $LOG;
100    
101     date +%s >> $LOG;
102    
103     R=2;
104    
105     fi
106    
107     if [ $R -gt 1 ]; then
108    
109     echo -n " PROBLEMS! " >> $LOG;
110    
111     echo " File $file not processed yet, I will retry later " >> $LOG;
112    
113     else
114    
115     YodaProfiler -rawFile $CLN1/$file -yodaFile $L0/$file >> $LOGDIR/profiler.`basename $file .root`.log 2>&1 ;
116     # YodaProfiler -force -rawFile $CLN1/$file -yodaFile $L0/$file >> $LOGDIR/profiler.`basename $file .root`.log 2>&1 ;
117    
118     echo $file >> $WRKDIR/profiler.profilerlist;
119    
120     sleep 15;
121    
122     fi;
123    
124     DONE=1;
125    
126     done;
127    
128     TIME=`tail -1 $WRKDIR/profiler.step `;
129    
130     while [ $TIME -eq 1 ]; do
131    
132     TIME=`tail -1 $WRKDIR/profiler.step `;
133    
134     echo -n " TIME = 1! DEAMON PAUSE " >> $LOG;
135    
136     date >> $LOG;
137    
138     sleep 120;
139    
140     done
141    
142     if [ $TIME -le 0 ]; then
143    
144     echo -n " EXIT DEAMON, RECEIVED TERM SIGNAL " >> $LOG;
145    
146     date >> $LOG;
147    
148     exit;
149    
150     fi
151    
152     done;
153    
154     TIME=`tail -1 $WRKDIR/profiler.step `;
155    
156     if [ $TIME -le 0 ]; then
157    
158     echo -n " EXIT DEAMON, RECEIVED TERM SIGNAL " >> $LOG;
159    
160     date >> $LOG;
161    
162     exit;
163    
164     fi
165    
166     while [ $TIME -eq 1 ]; do
167    
168     TIME=`tail -1 $WRKDIR/profiler.step `;
169    
170     echo -n " TIME = 1! DEAMON PAUSE " >> $LOG;
171    
172     date >> $LOG;
173    
174     sleep 120;
175    
176     done
177    
178     sleep $TIME;
179    
180     TIME=`tail -1 $WRKDIR/profiler.step `;
181    
182     done;
183    
184     echo -n " EXIT DEAMON, RECEIVED TERM SIGNAL " >> $LOG;
185    
186     date >> $LOG;

  ViewVC Help
Powered by ViewVC 1.1.23