/
check_for_zombie_jobs
executable file
·98 lines (86 loc) · 2.22 KB
/
check_for_zombie_jobs
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
#!/bin/bash
#
# Check for zombie jobs (not terminated).
# Also scan logs for ERROR messages
#
# shellcheck source=../environment.in
. ./environment
# shellcheck source= ./functions
. "${rscripts}"/functions
# check_for_zombie_jobs storage=STORAGE [client=localhost-fd]
if [ $# = 2 ] ; then
client="$2"
else
client="client"
fi
wait_for_jobs_to_terminate "${client}" 20
"${BAREOS_BCONSOLE_BINARY}" -c "${conf}" <<END_OF_DATA >/dev/null 2>&1
@output "${tmp}"/dir.out
status dir
@output "${tmp}"/fd.out
status ${client}
@output "${tmp}"/sd.out
status $1
@output
quit
END_OF_DATA
export zstat
if ! grep "No Jobs running." "${tmp}"/dir.out >/dev/null 2>&1
then
echo " "
echo " !!!! Zombie Jobs in Director !!!!"
echo " !!!! Zombie Jobs in Director !!!!" >>test.out
cat "${tmp}"/dir.out
echo " "
zstat=1
exit 1
fi
if ! grep "No Jobs running." "${tmp}"/fd.out >/dev/null 2>&1;
then
echo " "
echo " !!!! Zombie Jobs in File daemon !!!!"
echo " !!!! Zombie Jobs in File daemon !!!!" >>test.out
cat "${tmp}"/fd.out
echo " "
zstat=1
exit 1
fi
if ! grep "No Jobs running." "${tmp}"/sd.out >/dev/null 2>&1
then
echo " "
echo " !!!! Zombie Jobs in Storage daemon !!!!"
echo " !!!! Zombie Jobs in Storage daemon !!!!" >>test.out
cat "${tmp}"/sd.out
echo " "
zstat=1
exit 1
fi
if ls "${tmp}"/log*.out >/dev/null 2>&1; then
if grep "ERROR" "${tmp}"/log*.out >/dev/null 2>&1; then
echo " "
echo " !!!! ERROR in log output !!!!"
echo " !!!! ERROR in log output !!!!" >>test.out
grep "ERROR" "${tmp}"/log*.out
echo " "
zstat=1
exit 1
fi
if grep "Fatal Error" "${tmp}"/log*.out >/dev/null 2>&1; then
echo " "
echo " !!!! Fatal Error in log output !!!!"
echo " !!!! Fatal Error in log output !!!!" >>test.out
grep "Fatal Error" "${tmp}"/log*.out
echo " "
zstat=1
exit 1
fi
if grep "glibc detected" "${tmp}"/log*.out >/dev/null 2>&1; then
echo " "
echo " !!!! glibc detected Error in log output !!!!"
echo " !!!! glibc detected Error in log output !!!!" >>test.out
grep "glibc detected" "${tmp}"/log*.out
echo " "
zstat=1
exit 1
fi
fi