1#!/bin/sh
2#
3# Check for zombie jobs (not terminated).
4# Also scan logs for ERROR messages
5#
6
7. ./config
8
9# check_for_zombie_jobs storage=STORAGE [client=localhost-fd]
10
11if [ $# = 2 ] ; then
12    client="$2"
13else
14    client="client"
15fi
16
17${bin}/bconsole -c ${conf}/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
18@output ${tmp}/dir.out
19status dir
20@output ${tmp}/fd.out
21status ${client}
22@output ${tmp}/sd.out
23status $1
24@output
25quit
26END_OF_DATA
27
28export zstat
29grep "No Jobs running." ${tmp}/dir.out 2>&1 >/dev/null
30if [ $? != 0 ] ; then
31  echo " "
32  echo "  !!!! Zombie Jobs in Director !!!!"
33  echo "  !!!! Zombie Jobs in Director !!!!" >>test.out
34  cat ${tmp}/dir.out
35  echo " "
36  zstat=1
37  exit 1
38fi
39grep "No Jobs running." ${tmp}/fd.out 2>&1 >/dev/null
40if [ $? != 0 ] ; then
41  echo " "
42  echo "  !!!! Zombie Jobs in File daemon !!!!"
43  echo "  !!!! Zombie Jobs in File daemon !!!!" >>test.out
44  cat ${tmp}/fd.out
45  echo " "
46  zstat=1
47  exit 1
48fi
49grep "No Jobs running." ${tmp}/sd.out 2>&1 >/dev/null
50if [ $? != 0 ] ; then
51  echo " "
52  echo "  !!!! Zombie Jobs in Storage daemon !!!!"
53  echo "  !!!! Zombie Jobs in Storage daemon !!!!" >>test.out
54  cat ${tmp}/sd.out
55  echo " "
56  zstat=1
57  exit 1
58fi
59grep "ERROR" ${tmp}/log*.out 2>&1 >/dev/null
60if [ $? = 0 ] ; then
61  echo " "
62  echo "  !!!! ERROR in log output !!!!"
63  echo "  !!!! ERROR in log output !!!!" >>test.out
64  grep "ERROR" ${tmp}/log*.out
65  echo " "
66  zstat=1
67  exit 1
68fi
69grep "Fatal Error" ${tmp}/log*.out 2>&1 >/dev/null
70if [ $? = 0 ] ; then
71  echo " "
72  echo "  !!!! Fatal Error in log output !!!!"
73  echo "  !!!! Fatal Error in log output !!!!" >>test.out
74  grep "Fatal Error" ${tmp}/log*.out
75  echo " "
76  zstat=1
77  exit 1
78fi
79
80grep "glibc detected" ${tmp}/log*.out 2>&1 >/dev/null
81if [ $? = 0 ] ; then
82  echo " "
83  echo "  !!!! glibc detected Error in log output !!!!"
84  echo "  !!!! glibc detected Error in log output !!!!" >>test.out
85  grep "glibc detected" ${tmp}/log*.out
86  echo " "
87  zstat=1
88  exit 1
89fi
90