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

Contents of /productionkit/deamons/src/copydeamon.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (as text) (vendor branch)
Thu Nov 30 14:09:19 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
Error occurred while calculating annotation data.
Imported sources

1 #!/bin/bash
2
3 source /gpfs/wizard/flight/production/installed/set_pam_env.sh
4
5 source /gpfs/wizard/UIPnP/UIPnP.sh
6
7 if [ "$PAM_BIN" == "" ]; then exit; fi
8
9 export PRODDIR=/gpfs/wizard/flight/production/
10
11 export PRERR=$PRODDIR/preRawreader/
12
13 export WRKDIR=$PRODDIR/deamons/wrkdir/
14
15 export LOGDIR=$PRODDIR/logs/
16
17 #export CASTOR=gsiftp://lxfarm08.mephi.ru/scratch04/preRawreader/
18 export CASTOR=gsiftp://castorgrid.cr.cnaf.infn.it/castor/cnaf.infn.it/pamela/pamela-cnaf/data/flight/preRawreader/
19
20 touch $WRKDIR/copy.copylist
21
22 LOG=$WRKDIR/copy.log
23
24 STEP=$WRKDIR/copy.step
25
26 touch $LOG
27
28 echo -n " DEAMON STARTED AT " >> $LOG;
29
30 date >> $LOG;
31
32 echo "600" > $STEP;
33
34 TIME=`tail -1 $STEP`;
35
36 STARTPROXY=`date +%s`
37
38 voms-proxy-init --voms pamela -pwstdin < $WRKDIR/connect
39
40 while [ $TIME -gt 0 ]; do
41
42 STOPPROXY=`date +%s`
43
44 let DELTAPROXY=$STOPPROXY-$STARTPROXY
45
46 if [ $DELTAPROXY -gt 6000 ]; then
47
48 STARTPROXY=`date +%s`
49
50 voms-proxy-init --voms pamela -pwstdin < $WRKDIR/connect;
51
52 echo -n "(1) EXPIRED PROXY: " >> $LOG;
53
54 date >> $LOG;
55
56 fi
57
58 edg-gridftp-ls $CASTOR &> $WRKDIR/copy.rawlist
59 # ls $PRERR/02202004.pam &> $WRKDIR/copy.rawlist;
60
61 echo -n "#############>>>> DATE: " >> $LOG;
62
63 date >> $LOG;
64
65 for file in `sort -r $WRKDIR/copy.rawlist`; do
66 # for file in `sort $WRKDIR/copy.rawlist`; do
67
68 DONE=0;
69
70 CHECK=`grep $file $WRKDIR/copy.copylist`;
71
72 CHECKPAM=`echo $file | grep pam`
73
74 if [ "${CHECK}" != "" ]; then
75
76 DONE=1;
77
78 fi;
79
80 if [ "${CHECKPAM}" == "" ]; then
81
82 DONE=1;
83
84 fi;
85
86 if [ -s $PRERR/$file ]; then
87
88 DONE=1;
89
90 fi;
91
92
93 # for sentfile in `cat $WRKDIR/copy.copylist`; do
94
95 # CHECKPAM=`echo $file | grep pam`
96
97 # FNAME=`basename $file`
98
99 # if [ "${FNAME}" == "${sentfile}" ] || [ "${CHECKPAM}" == "" ]; then
100
101 # DONE=1;
102
103 # fi;
104
105 # if [ -s $PRERR/$FNAME ]; then
106
107 # DONE=1;
108
109 # fi;
110
111 # done
112
113 if [ $DONE -eq 0 ]; then
114
115 FNAME=`basename $file`
116
117 STOPPROXY=`date +%s`
118
119 let DELTAPROXY=$STOPPROXY-$STARTPROXY
120
121 if [ $DELTAPROXY -gt 6000 ]; then
122
123 STARTPROXY=`date +%s`
124
125 voms-proxy-init --voms pamela -pwstdin < $WRKDIR/connect
126
127 echo -n "(2) EXPIRED PROXY: " >> $LOG;
128
129 date >> $LOG;
130
131 fi
132
133 CNAME1=`edg-gridftp-ls --verbose $CASTOR | grep $FNAME`;
134
135 sleep 30;
136
137 STOPPROXY=`date +%s`
138
139 let DELTAPROXY=$STOPPROXY-$STARTPROXY
140
141 if [ $DELTAPROXY -gt 6000 ]; then
142
143 STARTPROXY=`date +%s`
144
145 voms-proxy-init --voms pamela -pwstdin < $WRKDIR/connect
146
147 echo -n "(2) EXPIRED PROXY: " >> $LOG;
148
149 date >> $LOG;
150
151 fi
152
153 CNAME2=`edg-gridftp-ls --verbose $CASTOR | grep $FNAME`;
154
155 echo $CNAME2 >> $LOG;
156
157 while [ "$CNAME1" != "$CNAME2" ]; do
158
159 CNAME2=`edg-gridftp-ls --verbose $CASTOR | grep $FNAME`;
160
161 sleep 30;
162
163 echo -n "UNFINISHED FILE: " >> $LOG;
164
165 date >> $LOG;
166
167 echo $CNAME1 >> $LOG;
168
169 echo $CNAME2 >> $LOG;
170
171 STOPPROXY=`date +%s`
172
173 let DELTAPROXY=$STOPPROXY-$STARTPROXY
174
175 if [ $DELTAPROXY -gt 6000 ]; then
176
177 STARTPROXY=`date +%s`
178
179 voms-proxy-init --voms pamela -pwstdin < $WRKDIR/connect
180
181 fi
182
183 CNAME1=`edg-gridftp-ls --verbose $CASTOR | grep $FNAME`;
184
185 done;
186
187 echo "Transferring $FNAME!" >> $LOG;
188
189 STOPPROXY=`date +%s`
190
191 let DELTAPROXY=$STOPPROXY-$STARTPROXY
192
193 if [ $DELTAPROXY -gt 6000 ]; then
194
195 STARTPROXY=`date +%s`
196
197 voms-proxy-init --voms pamela -pwstdin < $WRKDIR/connect
198
199 echo -n "(3) EXPIRED PROXY: " >> $LOG;
200
201 date >> $LOG;
202
203 fi
204
205 globus-url-copy $CASTOR/$FNAME file://$PRERR/$FNAME;
206
207 if [ -s $PRERR/$FNAME ]; then
208
209 echo "$FNAME succesfully transmitted (I think)" >> $LOG;
210
211 echo $FNAME >> $WRKDIR/copy.copylist;
212
213 else
214
215 echo "Some problem occured for file $FNAME, it is empty" >> $LOG;
216
217 echo "$FNAME scheduled to be retransmitted" >> $LOG;
218
219 fi;
220
221 HOUR=`date +%H`;
222
223 if [ $HOUR -gt 6 ] && [ $HOUR -lt 19 ]; then
224
225 echo "Hour is ${HOUR}, day-time I will sleep for 5 seconds" >> $LOG;
226
227 sleep 5;
228
229 else
230
231 echo "Hour is ${HOUR}, night-time I will sleep for 1 seconds" >> $LOG;
232
233 sleep 1;
234
235 fi;
236
237 fi;
238
239 TIME=`tail -1 $STEP `;
240
241 if [ $TIME -le 0 ]; then
242
243 echo -n " EXIT DEAMON, RECEIVED TERM SIGNAL " >> $LOG;
244
245 date >> $LOG;
246
247 exit;
248
249 fi
250
251 done;
252
253 sleep $TIME;
254
255 TIME=`tail -1 $STEP`;
256
257 done;
258
259 echo -n " EXIT DEAMON, RECEIVED TERM SIGNAL " >> $LOG;
260
261 date >> $LOG;
262
263
264 # if [ -f $HDEAM/tr.log ]; then
265
266 # cat $HDEAM/tr.log | mail -s "Log from retrieving deamon" Emiliano.Mocchiutti@ts.infn.it
267
268 # rm -f $HDEAM/tr.log;
269
270 # fi;
271

  ViewVC Help
Powered by ViewVC 1.1.23