]> git.sur5r.net Git - bacula/bacula/blob - regress/scripts/check_for_zombie_jobs
Backport from Bacula Enterprise
[bacula/bacula] / regress / scripts / check_for_zombie_jobs
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Check for zombie jobs (not terminated).
9 # Also scan logs for ERROR messages
10 #
11
12 . ./config
13
14 # check_for_zombie_jobs storage=STORAGE [client=localhost-fd]
15
16 if [ $# = 2 ] ; then
17     client="$2"
18 else 
19     client="client"
20 fi
21
22 ${bin}/bconsole -c ${scripts}/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
23 @output ${tmp}/dir.out
24 status dir
25 @output ${tmp}/fd.out
26 status ${client}
27 @output ${tmp}/sd.out
28 status $1
29 @output
30 quit
31 END_OF_DATA
32
33 export zstat
34 grep "No Jobs running." ${tmp}/dir.out 2>&1 >/dev/null
35 if [ $? != 0 ] ; then
36   echo " "
37   echo "  !!!! Zombie Jobs in Director !!!!"
38   echo "  !!!! Zombie Jobs in Director !!!!" >>test.out
39   if test "$debug" = "1" ; then cat ${tmp}/dir.out; fi
40   echo " "
41   zstat=1
42   exit 1
43 fi
44 grep "No Jobs running." ${tmp}/fd.out 2>&1 >/dev/null
45 if [ $? != 0 ] ; then
46   echo " "
47   echo "  !!!! Zombie Jobs in File daemon !!!!"
48   echo "  !!!! Zombie Jobs in File daemon !!!!" >>test.out
49   if test "$debug" = "1" ; then cat ${tmp}/fd.out; fi
50   echo " "
51   zstat=1
52   exit 1
53 fi
54 grep "No Jobs running." ${tmp}/sd.out 2>&1 >/dev/null
55 if [ $? != 0 ] ; then
56   echo " "
57   echo "  !!!! Zombie Jobs in Storage daemon !!!!"
58   echo "  !!!! Zombie Jobs in Storage daemon !!!!" >>test.out
59   if test "$debug" = "1" ; then cat ${tmp}/sd.out; fi
60   echo " "
61   zstat=1
62   exit 1
63 fi
64 grep " READ " ${tmp}/sd.out 2>&1 >/dev/null
65 if [ $? = 0 ]; then
66   echo " "
67   echo "  !!!! Zombie \"Read\" Jobs in Storage daemon !!!!"
68   echo "  !!!! Zombie \"Read\" Jobs in Storage daemon !!!!" >>test.out
69   if test "$debug" = "1" ; then cat ${tmp}/sd.out; fi
70   echo " "
71   zstat=1
72   exit 1
73 fi
74 grep "ERROR" ${tmp}/log*.out 2>&1 >/dev/null
75 if [ $? = 0 ] ; then
76   echo " "
77   echo "  !!!! ERROR in log output !!!!"
78   echo "  !!!! ERROR in log output !!!!" >>test.out
79   grep "ERROR" ${tmp}/log*.out
80   echo " "
81   zstat=1
82   exit 1
83 fi
84 grep "Fatal Error" ${tmp}/log*.out 2>&1 >/dev/null
85 if [ $? = 0 ] ; then
86   echo " "
87   echo "  !!!! Fatal Error in log output !!!!"
88   echo "  !!!! Fatal Error in log output !!!!" >>test.out
89   grep "Fatal Error" ${tmp}/log*.out
90   echo " "
91   zstat=1
92   exit 1
93 fi
94
95 grep "glibc detected" ${tmp}/log*.out 2>&1 >/dev/null
96 if [ $? = 0 ] ; then
97   echo " "
98   echo "  !!!! glibc detected Error in log output !!!!"
99   echo "  !!!! glibc detected Error in log output !!!!" >>test.out
100   grep "glibc detected" ${tmp}/log*.out
101   echo " "
102   zstat=1
103   exit 1
104 fi