summaryrefslogtreecommitdiffstats
path: root/abs/core/xymon/hobbit-myth-orphan.sh
blob: cc4ca306450de0cf9da657646ac0d90b1c206287 (plain)
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
#!/bin/bash
TMPFILE=/tmp/oprhan.result
MYTHCONFDIR=/usr/share/mythtv /usr/LH/bin/find_orphans.py --printonly > $TMPFILE


COLUMN=orphan    # Name of the column
COLOR=green      # By default, everything is OK
MSG="No Orphans Found."




#yellow
for i in "Orphaned video files" "Orphaned snapshots" "Database backups" "Other files" "Recordings with missing files" "Zero byte recordings"
do
   grep -q  "$i" $TMPFILE
   status=$?
   if [ $status -eq 0 ]
   then
       COLOR="yellow"
       MSG="Problems with $i"
   fi
done

#red
#for i in "Recordings with missing files" "Zero byte recordings"
#do
#   grep -q  "$i" $TMPFILE
#   status=$?
#   if [ $status -eq 0 ]
#   then
#       COLOR="red"
#       MSG="Problems with $i"
#   fi
#done

MSG="
    ${MSG}
    `cat $TMPFILE` "
# Tell Hobbit about it
$BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date`
   ${MSG}
   " 
exit 0