-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmoketracking
executable file
·568 lines (537 loc) · 27.7 KB
/
smoketracking
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
#!/bin/csh -f
#******************************************************************************
# PURPOSE: smoketracking - get the SMOKE run home directory
# list directory contents, script settings and
# input and output filenames for diagnostics or to replicate SMOKE run
#
# NOTE: Requires program log_analyzer
# NOTE: First set the SMK_HOME env variable to the base SMOKE installation
# NOTE: Then source the assigns file for the SMOKE runs
#
# USAGE: ./smoketracking
#
# HISTORY: 2014-06-25 lizadams@email.unc.edu, Created.
# STATUS: unreviewed, tested.
#******************************************************************************
if ( ! $?SMK_HOME ) then
echo 'please set 'SMK_HOME' environment variable and source assigns file'
exit
endif
setenv ldir $SMK_HOME/subsys/smoke/scripts/run/smoke-tracking/log_analyzer
set log_analyzer = `python $ldir/log_analyzer.py -k $ldir/known_messages.txt -l 2 -f $ldir/test_log4.csv $LOGS/$SRCABBR/*_${SRCABBR}_*log`
set done = 0
set prefix_byte_count = 0
while ( $done == 0 )
if ( $#argv == 0 ) then
set input = ( ' ' )
set done = 1;
else if ( "$1" == 'loop' ) then
set input = "$<"
set input = ( $input )
set prefix_byte_count = 1; # Prefix all output with a byte count.
else
set input = ( $argv )
set done = 1;
endif
if ( "$input[1]" == 'status' ) then
# create a temporary directory to store files containing grep output
mkdir -p ./tmp
endif
set array = (Success Failure)
if ( "$input[2]" == 'A' ) then
foreach program ( smkinven spcmat grdmat temporal smkmerge )
set tmp_file = "./tmp/${program}.$SRCABBR.$$"
set logfile = "${program}_${SRCABBR}_*.log"
set reportfile = "report.$SRCABBR.$program.$GRID.$ASCEN.$$.rpt"
grep 'Normal Completion' $LOGS/$SRCABBR/$logfile >> $tmp_file
echo "========================================="
set id = `grep -c 'Normal Completion' $tmp_file`
if ( $id >= 1 ) then
echo "=========================================" |& tee -a $reportfile
echo "$program $array[1] `grep -c 'Normal Completion' $tmp_file` times" |& tee -a $reportfile
echo "=========================================" |& tee -a $reportfile
echo ${GRID} $ASCEN $SRCABBR "REPORT: " >> $reportfile
echo 'File name and location at time' ${program} 'was run - NOTE: Directory Location may have been moved after run completed' >> $reportfile
# note >> appends to the end of the file
ls $LOGS/$SRCABBR/$logfile >> $reportfile
grep -A 1 OPEN $LOGS/$SRCABBR/$logfile >> $reportfile
grep -A 1 'opened as NEW' $LOGS/$SRCABBR/$logfile >> $reportfile
grep -A 1 'opened as UNKNOWN' $LOGS/$SRCABBR/$logfile >> $reportfile
grep 'opened as OLD' $LOGS/$SRCABBR/$logfile | grep -v TMP >> $reportfile
grep -A 1 -i 'opened for input' $LOGS/$SRCABBR/$logfile >> $reportfile
grep -A 1 -i 'opened for output' $LOGS/$SRCABBR/$logfile >> $reportfile
grep 'Value for' $LOGS/$SRCABBR/$logfile >> $reportfile
else if ($id == 0) then
grep -B 4 -A 2 'ERROR ABORT in subroutine' $LOGS/$SRCABBR/$logfile
echo "========================================="
echo "${program} logfile unsuccessful: check and rerun program"
echo "location of log file:"
ls $LOGS/$SRCABBR/$logfile
echo "----------------------------------"
echo $log_analyzer
echo "more information is available from log_analyzer under ./tmp/test.log4"
break
endif
end
echo "=========================================" >> $reportfile
echo "Log File Names and Date Stamps" >> $reportfile
echo "=========================================" >> $reportfile
ls $LOGS/$SRCABBR/*_${SRCABBR}_*.log >> $reportfile
echo '$SRCABBR=' $SRCABBR
echo '$LOGS='$LOGS
echo 'log=' ${LOGS}/${SRCABBR}/smkinven*.log
set invlogdate = `stat -c%Y $LOGS/$SRCABBR/smkinven*.log`
set spcmatcmaqdate = `stat -c%Y $LOGS/$SRCABBR/spcmat_${SRCABBR}_*cmaq*.log`
set spcmatcamxdate = `stat -c%Y $LOGS/$SRCABBR/spcmat_${SRCABBR}_*camx*.log`
set grdmatdate = `stat -c%Y $LOGS/$SRCABBR/grdmat_${SRCABBR}_*$GRID*.log`
set temporaldate = `stat -c%Y $LOGS/$SRCABBR/temporal_${SRCABBR}_*.log`
# set smk2emisdate = `stat -c%Y $LOGS/$SRCABBR/smk2emis_${SRCABBR}_*$GRID*.log`
set filedate = $invlogdate
# echo 'filedate = '$invlogdate
echo "============================="
echo "checking if smkinven was run prior to other programs"
echo "=============================="
foreach program ( smkinven spcmat grdmat temporal smkmerge )
if ($program == smkinven) then
set logdate = $invlogdate
else if ($program == spcmat) then
set logdate = $spcmatcmaqdate
else if ($program == grdmat) then
set logdate = $grdmatdate
else if ($program == temporal) then
set logdate = $temporaldate
else if ($program == smkmerge) then
echo "============================="
echo "if there is more than one smkkmerge log file, then the last one will be used to check the logfile time"
echo "=============================="
foreach file (`ls $LOGS/$SRCABBR/smkmerge_${SRCABBR}_*.log` )
set mergedate = `ls $file | awk -F _ '{print $7}'`
set mergelogdate = `stat -c%Y $LOGS/$SRCABBR/smkmerge_${SRCABBR}_*${mergedate}_${GRID}*.log`
set logdate = $mergelogdate
end
# else if ($program == smk2emis) then
# set logdate = $smk2emisdate
endif
if ($logdate >= $invlogdate) then
if ($program == smkinven) then
else if ($program == spcmat) then
echo "$program was run after smkinven"
else if ($program == grdmat) then
echo "$program was run after smkinven"
else if ($program == temporal) then
echo "$program was run after smkinven"
else if ($program == smkmerge) then
echo "$program was run after smkinven"
endif
else
if ($program == smkinven) then
echo 'smkinven'
else if ($program == spcmat) then
echo "The logfile for smkinven is NEWER than $program. You may need to rerun all of the programs after smkinven"
else if ($program == grdmat) then
echo "The logfile for spcmat is NEWER than $program. You *may* need to rerun grdmat, if an ERROR was reported above"
else if ($program == temporal) then
echo "The logfile for grdmat is NEWER than $program. You may need to rerun temporal, if an ERROR was reported above"
else if ($program == smkmerge) then
echo "The logfile for temporal is NEWER than $program. You may need to rerun smkmerge"
# else if ($program == smk2emis) then
# echo "The logfile for temporal is NEWER than $program. You may need to rerun smk2emis"
endif
endif
set filedate = $logdate
end
echo "============================="
echo "checking if smkmerge was run after all other programs"
echo "=============================="
foreach program ( smkinven spcmat grdmat temporal smkmerge )
if ($program == smkinven) then
set nlogdate = $invlogdate
else if ($program == spcmat) then
set nlogdate = $spcmatcmaqdate
else if ($program == grdmat) then
set nlogdate = $grdmatdate
else if ($program == temporal) then
set nlogdate = $temporaldate
else if ($program == smkmerge) then
set nlogdate = $mergelogdate
# else if ($program == smk2emis) then
# set nlogdate = $smk2emisdate
endif
if ($nlogdate <= $mergelogdate) then
if ($program == smkmerge) then
else if ($program == spcmat) then
echo "smkmerge was run after $program"
else if ($program == grdmat) then
echo "smkmerge was run after $program"
else if ($program == temporal) then
echo "smkmerge was run after $program"
# else if ($program == smk2emis) then
# echo "smkmerge was run after $program"
endif
else
echo "========================================"
if ($program == smkinven) then
echo "ERROR - smkmerge was run before $program. You need to RERUN smkmerge"
else if ($program == spcmat) then
echo "ERROR - smkmerge was run before $program. You need to RERUN smkmerge"
else if ($program == grdmat) then
echo "ERROR - smkmerge was run before $program. You need to RERUN smkmerge"
else if ($program == temporal) then
echo "ERROR - smkmerge was run before $program. You need to RERUN smkmerge"
else if ($program == smkmerge) then
echo "ERROR - smkmerge was run before $program. You need to RERUN smkmerge"
endif
echo "========================================"
endif
end
set maxtmp = 0
foreach logdate ( $mergelogdate $invlogdate $spcmatcmaqdate $grdmatdate $temporaldate )
if ($logdate >= $maxtmp) then
# echo "date $logdate is older recent than previous program"
set maxtmp = $logdate
else
# echo "date $logdate is more recent than the next program, may need to rerun"
endif
end
if ( $maxtmp == $mergelogdate ) then
echo "$array[1] in the order of runs: Smkmerge was correctly run after all processes"
# else if ( $maxtmp == $smk2emisdate ) then
# echo "$array[1] in the order of runs: Smkmerge was correctly run after all processes except smk2emis"
# else if ( $maxtmp != $smk2emisdate ) then
# echo "SMKMERGE may need to be rerun, it's log file must be run after all other processes except smk2emis"
endif
echo 'note: spcmat, grdmat and temporal can be run independently, but after smkinven and before smkmerge'
# rm ./tmp/*${SRCABBR}*
else if ( "$input[2]" == 'P' ) then
echo 'in Point source'
foreach program ( smkinven spcmat elevpoint grdmat laypoint mrgelev temporal smkmerge )
set tmp_file = "./tmp/${program}.$SRCABBR.$$"
set logfile = "${program}_${SRCABBR}_*.log"
set reportfile = "report.$SRCABBR.${G_STDATE}_stdate.$$.log"
grep 'Normal Completion' $LOGS/$SRCABBR/$logfile >> ${tmp_file}
set id = `grep -c 'Normal Completion' ${tmp_file}`
if ( $id >= 1 ) then
echo "=========================================" |& tee -a $reportfile
echo "$program $array[1] `grep -c 'Normal Completion' $tmp_file` times" |& tee -a $reportfile
echo "=========================================" |& tee -a $reportfile
echo 'File name and location at time' ${program} 'was run - NOTE: Directory Location may have been moved after run completed' >> $reportfile
ls $LOGS/$SRCABBR/$logfile >> $reportfile
grep -A 1 OPEN $LOGS/$SRCABBR/$logfile >> $reportfile
grep -A 1 'opened as NEW' $LOGS/$SRCABBR/$logfile >> $reportfile
grep -A 1 'opened as UNKNOWN' $LOGS/$SRCABBR/$logfile >> $reportfile
grep -A 1 'opened as OLD' $LOGS/$SRCABBR/$logfile | grep -v TMP >> $reportfile
grep -A 1 -i 'opened for input' $LOGS/$SRCABBR/$logfile >> $reportfile
grep -A 1 -i 'opened for output' $LOGS/$SRCABBR/$logfile >> $reportfile
else if ($id == 0) then
grep -B 4 -A 2 'ERROR ABORT in subroutine' $LOGS/$SRCABBR/$logfile
echo "========================================="
echo "${program} logfile unsuccessful: check and rerun program"
echo "location of log file:"
ls $LOGS/$SRCABBR/$logfile
echo "----------------------------------"
echo $log_analyzer
echo "more information is available from log_analyzer under ./tmp/* files"
break
endif
echo "========================================="
end
echo "=========================================" >> $reportfile
echo "Log File Names and Date Stamps" >> $reportfile
echo "=========================================" >> $reportfile
ls $LOGS/$SRCABBR/*_${SRCABBR}_*.log >> $reportfile
set mergelogdate = `stat -c%Y $LOGS/$SRCABBR/smkmerge_${SRCABBR}_*${G_STDATE}_$GRID*.log`
set invlogdate = `stat -c%Y $LOGS/$SRCABBR/smkinven_${SRCABBR}_*.log`
set spcmatcmaqdate = `stat -c%Y $LOGS/$SRCABBR/spcmat_${SRCABBR}_*cmaq*.log`
set spcmatcamxdate = `stat -c%Y $LOGS/$SRCABBR/spcmat_${SRCABBR}_*camx*.log`
set elevpointdate = `stat -c%Y $LOGS/$SRCABBR/elevpoint_${SRCABBR}_*.log`
set mrgelevdate = `stat -c%Y $LOGS/$SRCABBR/mrgelev_${SRCABBR}_*$GRID*.log`
set grdmatdate = `stat -c%Y $LOGS/$SRCABBR/grdmat_${SRCABBR}_*$GRID*.log`
set laypointdate = `stat -c%Y $LOGS/$SRCABBR/laypoint_${SRCABBR}_*$GRID*.log`
set temporaldate = `stat -c%Y $LOGS/$SRCABBR/temporal_${SRCABBR}_*.log`
set smk2emisdate = `stat -c%Y $LOGS/$SRCABBR/smk2emis_${SRCABBR}_*$GRID*.log`
set filedate = $invlogdate
echo "============================="
echo "checking if smkinven was run prior to other programs"
echo "=============================="
foreach program ( smkinven spcmat grdmat laypoint temporal smkmerge )
if ($program == smkinven) then
set logdate = $invlogdate
else if ($program == spcmat) then
set logdate = $spcmatcmaqdate
else if ($program == grdmat) then
set logdate = $grdmatdate
else if ($program == laypoint) then
set logdate = $laypointdate
else if ($program == temporal) then
set logdate = $temporaldate
else if ($program == smkmerge) then
set logdate = $mergelogdate
endif
if ($logdate >= $invlogdate) then
set filedate = $logdate
if ($program == spcmat) then
echo "$program was run after smkinven"
else if ($program == grdmat) then
echo "$program was run after smkinven"
else if ($program == laypoint) then
echo "$program was run after smkinven"
else if ($program == temporal) then
echo "$program was run after smkinven"
else if ($program == smkmerge) then
echo "$program was run after smkinven"
endif
else
if ($program == smkinven) then
else if ($program == spcmat) then
echo "The logfile for smkinven is NEWER than $program. You need to rerun programs after smkinven"
else if ($program == grdmat) then
echo "The logfile for smkinven is NEWER than $program. You need to rerun grdmat"
else if ($program == laypoint) then
echo "The logfile for smkinven is NEWER than $program. You need to rerun laypoint"
else if ($program == temporal) then
echo "The logfile for smkinven is NEWER than $program. You need to rerun temporal"
else if ($program == smkmerge) then
echo "The logfile for smkinven is NEWER than $program. You need to rerun smkmerge"
else if ($program == smk2emis) then
echo "The logfile for smkinven is NEWER than $program. You need to rerun smk2emis"
endif
endif
end
echo "============================="
echo "checking if smkmerge was run after all other programs"
echo "=============================="
foreach program ( smkinven spcmat grdmat laypoint temporal smkmerge )
if ($program == smkinven) then
set logdate = $invlogdate
else if ($program == spcmat) then
set logdate = $spcmatcmaqdate
else if ($program == grdmat) then
set logdate = $grdmatdate
else if ($program == laypoint) then
set logdate = $laypointdate
else if ($program == temporal) then
set logdate = $temporaldate
else if ($program == smkmerge) then
set logdate = $mergelogdate
endif
if ($logdate <= $mergelogdate) then
if ($program == smkmerge) then
else if ($program == spcmat) then
echo "smkmerge was run after $program"
else if ($program == grdmat) then
echo "smkmerge was run after $program"
else if ($program == laypoint) then
echo "smkmerge was run after $program"
else if ($program == temporal) then
echo "smkmerge was run after $program"
endif
else
echo "========================================"
if ($program == smkinven) then
echo "ERROR - smkmerge was run before $program. You need to RERUN smkmerge"
else if ($program == spcmat) then
echo "ERROR - smkmerge was run before $program. You need to RERUN smkmerge"
else if ($program == grdmat) then
echo "ERROR - smkmerge was run before $program. You need to RERUN smkmerge"
else if ($program == laypoint) then
echo "ERROR - smkmerge was run before $program. You need to RERUN smkmerge"
else if ($program == temporal) then
echo "ERROR - smkmerge was run before $program. You need to RERUN smkmerge"
else if ($program == smkmerge) then
echo "ERROR - smkmerge was run before $program. You need to RERUN smkmerge"
endif
echo "========================================"
endif
end
set maxtmp = 0
foreach logdate ( $mergelogdate $invlogdate $spcmatcmaqdate $grdmatdate $laypointdate $temporaldate )
if ($logdate >= $maxtmp) then
## echo "date $logdate is older recent than previous program"
set maxtmp = $logdate
else
## echo "date $logdate is more recent than the next program, may need to rerun"
endif
end
if ( $maxtmp == $mergelogdate ) then
echo "$array[1] in the order of runs: Smkmerge was correctly run after all processes"
else
echo "SMKMERGE may need to be rerun, it's log file must be run after all other processes except smk2emis"
endif
echo 'note: spcmat, grdmat and temporal can be run independently, as long as they are run after smkinven and prior to smkmerge'
# rm ./tmp/*_${SRCABBR}_*
else if ( "$input[2]" == 'B' ) then
foreach program ( tmpbeis3 normbeis3 smkmerge )
echo 'in Biogenic source'
set tmp_file = "./tmp/${program}_$SRCABBR.$$"
set reportfile = "report.$SRCABBR.$program.$GRID.$ASCEN.$$.rpt"
set logfile = "${program}_${SRCABBR}_*.log"
grep 'Normal Completion' $LOGS/$logfile >> $biogenic_file
echo "$program $array[1] `grep -c 'Normal Completion' $biogenic_file` times"
if ( $id >= 1 ) then
echo "=========================================" |& tee -a $reportfile
echo "$program $array[1] `grep -c 'Normal Completion' $tmp_file` times" |& tee -a $reportfile
echo "=========================================" |& tee -a $reportfile
echo 'File name and location at time' ${program} 'was run - NOTE: Directory Location may have been moved after run completed' >> $reportfile
ls $LOGS/$SRCABBR/$logfile >> $reportfile
grep -A 1 OPEN $LOGS/$SRCABBR/$logfile >> $reportfile
grep -A 1 'opened as NEW' $LOGS/$SRCABBR/$logfile >> $reportfile
grep -A 1 'opened as UNKNOWN' $LOGS/$SRCABBR/$logfile >> $reportfile
grep -A 1 'opened as OLD' $LOGS/$SRCABBR/$logfile | grep -v TMP >> $reportfile
grep -A 1 -i 'opened for input' $LOGS/$SRCABBR/$logfile >> $reportfile
grep -A 1 -i 'opened for output' $LOGS/$SRCABBR/$logfile >> $reportfile
else if ($id == 0) then
grep -B 4 -A 2 'ERROR ABORT in subroutine' $LOGS/$SRCABBR/$logfile
echo "========================================="
echo "${program} logfile unsuccessful: check and rerun program"
echo "location of log file:"
ls $LOGS/$SRCABBR/$logfile
echo "----------------------------------"
echo $log_analyzer
echo "more information is available from log_analyzer under ./tmp/* files"
break
endif
echo "========================================="
echo "Log File Names and Date Stamps" >> $reportfile
ls $LOGS/$SRCABBR/*_${SRCABBR}_*.log >> $reportfile
set mergelogdate = `stat -c%Y $LOGS/$SRCABBR/smkmerge_$SRCABBR*.log`
set invlogdate = `stat -c%Y $LOGS/$SRCABBR/smkinven_${SRCABBR}_*.log`
set tmpbeis3date = `stat -c%Y $LOGS/$SRCABBR/tmpbeis3_$SRCABBR*.log`
set normbeis3date = `stat -c%Y $LOGS/$SRCABBR/normbeis3_$SRCABBR*.log`
# set smk2emisdate = `stat -c%Y $LOGS/$SRCABBR/smk2emis_$SRCABBR*.log`
set filedate = $invlogdate
echo "============================="
echo "checking if smkinven was run prior to other programs"
echo "=============================="
foreach program ( smkinven tmpbeis3 normbeis3 smkmerge )
if ($program == smkinven) then
set logdate = $invlogdate
else if ($program == tmpbeis3) then
set logdate = $tmpbeis3date
else if ($program == normbeis3) then
set logdate = $normbeis3date
# else if ($program == smk2emis) then
# set logdate = $smk2emisdate
else if ($program == smkmerge) then
set logdate = $mergelogdate
endif
if ($logdate >= $invlogdate) then
set filedate = $logdate
if ($program == tmpbeis3) then
echo "$program was run after smkinven"
else if ($program == normbeis3) then
echo "$program was run after smkinven"
# else if ($program == smk2emis) then
# echo "$program was run after smkinven"
else if ($program == smkmerge) then
echo "$program was run after smkinven"
endif
else
if ($program == smkinven) then
else if ($program == tmpbeis3) then
echo "The logfile for smkinven is NEWER than $program. You need to rerun programs after smkinven"
else if ($program == normbeis3) then
echo "The logfile for smkinven is NEWER than $program. You need to rerun $program"
else if ($program == smkmerge) then
echo "The logfile for smkinven is NEWER than $program. You need to rerun $program"
# else if ($program == smk2emis) then
# echo "The logfile for smkinven is NEWER than $program. You need to rerun $program"
endif
endif
end
set maxtmp = 0
foreach logdate ( $mergelogdate $tmpbeis3date $normbeis3date )
#$smk2emisdate
if ($logdate >= $maxtmp) then
set maxtmp = $logdate
else
endif
end
if ( $maxtmp == $mergelogdate ) then
echo "$array[1] in the order of runs: Smkmerge was correctly run after all processes"
# else if ( $maxtmp == $smk2emisdate ) then
# echo "$array[1] in the order of runs: Smkmerge was correctly run after all processes except smk2emis"
# else if ( $maxtmp != $smk2emisdate ) then
# echo "SMKMERGE may need to be rerun, it's log file must be run after all other processes except smk2emis"
endif
else if ( "$input[2]" == 'M' ) then
foreach program ( smkinven grdmat smkmerge )
set mobile_file = "./tmp/${program}.mobile.$$"
grep 'Normal Completion' $LOGS/${program}.mb.*.log >> $mobile_file
echo "$program $array[1] `grep -c 'Normal Completion' $mobile_file` times"
end
ls $LOGS/*.mb*.log
set mergelogdate = `stat -c%Y $LOGS/smkmerge*mb*.log`
set invlogdate = `stat -c%Y $LOGS/smkinven*mb*.log`
set spcmatdate = `stat -c%Y $LOGS/spcmat*mb*.log`
set grdmatdate = `stat -c%Y $LOGS/grdmat*mb*.log`
set temporaldate = `stat -c%Y $LOGS/temporal*mb*.log`
set maxtmp = 0
foreach logdate ( $mergelogdate $invlogdate $spcmatdate $grdmatdate $temporaldate )
if ($logdate >= $maxtmp) then
echo "date $logdate is older recent than previous program"
set maxtmp = $logdate
else
echo "date $logdate is more recent than the next program, may need to rerun"
endif
end
if ( $maxtmp == $mergelogdate ) then
echo "$array[1] in the order of runs: Smkmerge was correctly run after all processes"
# else if ( $maxtmp == $smk2emisdate ) then
# echo "$array[1] in the order of runs: Smkmerge was correctly run after all processes except smk2emis"
# else if ( $maxtmp != $smk2emisdate ) then
# echo "SMKMERGE may need to be rerun, it's log file must be run after all other processes except smk2emis"
endif
endif
else if ( "$input[1]" == 'debug' ) then
if ( $prefix_byte_count == 0 ) then
echo '../'
/bin/ls -1Lp "$input[2]"
else
echo '../' > $temp_file
/bin/ls -1Lp "$input[2]" >> $temp_file
/bin/ls $temp_file | /usr/bin/awk '{ print $5 }'
/bin/cat $temp_file
/bin/rm -f $temp_file
endif
else if ( "$input[1]" == 'variables' ) then
if ( $prefix_byte_count == 0 ) then
${log_analyzer} "$input[2]"
else
${log_analyzer} "$input[2]" > $temp_file
/bin/ls -l $temp_file | /usr/bin/awk '{ print $5 }'
/bin/cat $temp_file
/bin/rm -f $temp_file
endif
else if ( "$input[1]" == 'subset' ) then
set variables = ''
@ count = $#input
@ index = 3
while ( $index <= $count )
set variables = "$variables $input[$index]"
@ index += 1
end
$ncvariable "$input[2]" $temp_file $variables
if ( $prefix_byte_count == 1 ) then # First output file byte count:
/bin/ls -l $temp_file | /usr/bin/awk '{ print $5 }'
endif
/bin/cat $temp_file
/bin/rm -f $temp_file
else if ( "$input[1]" == 'quit' ) then
set done = 1
else
echo
echo "$0 - Diagnose smoke runs and track input/output and log files."
echo
echo "Usage: $0 status sector "
echo
echo 'Examples:'
echo
echo "command syntax:"
echo "$0 status area"
echo "output:"
echo 'smkinven Success 1 times'
echo
echo 'Comments, questions: lizadams@email.unc.edu, 1-919-843-0518.'
echo
endif
end