-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjobChecker.sh
61 lines (50 loc) · 1.34 KB
/
jobChecker.sh
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
#!/bin/bash
directory=$1
runChecks () {
for job in $directory/Job*/; do
echo "
==============================
this is:
$job
==============================
"
echo "
log:
"
# search for words that might indicated a problem
if tail $job/Task1.log | grep -i -q "exit"; then
echo "
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%% FINISHED %%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
"
fi
if tail $job/Task1.log | grep -i -q "error"; then
echo "
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!! ERROR !!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
"
fi
# print the tail of the log
tail $job/Task1.log
echo "
diary:
"
# print the tail of the diary
tail $job/Task1.diary.txt
echo "
------------------------------
finito
------------------------------
"
done
}
if [[ "$2" == "view" ]]; then
runChecks
elif [[ "$2" == "check" ]]; then
# only output if there is a warning or error
if runChecks | grep -i -q "error"; then echo "there is an errored job"; fi
if runChecks | grep -i -q "finished"; then echo "there is a finished job"; fi
echo "there is nothing else to report"
fi