summaryrefslogtreecommitdiffstats
path: root/abs/core/xymon/hobbit-myth-orphan.sh
blob: 5f7c7bae223fe9c84d1ac7c9cbe139c3c7f824e3 (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
#!/bin/bash
TMPFILE=/tmp/orphan.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 ]] && [[ $i == "Database backups" ]]
   then
       MSG="$i"
   elif [ $status -eq 0 ]
   then
       COLOR="yellow"
       MSG="Problems with"
   fi
done

if [[ $MSG == "Database backups" ]]
then
MSG="
`cat $TMPFILE`
"
elif [[ $MSG != "No Orphans Found." ]]
then
MSG="
${MSG} `cat $TMPFILE`

<b>From <a href="/shell/" target="_blank">System >> Terminal</a> run find_orphans.py to clean up these issues.</b>
"
fi

# Tell Hobbit about it
$BB $BBDISP "status $MACHINE.$COLUMN $COLOR Results from find_orphans.py
    ${MSG}
    "
exit 0