summaryrefslogtreecommitdiffstats
path: root/abs/core/xymon/hobbit-myth-orphan.sh
blob: ff91fb5605aa39741fdff2a2cf1293972906e894 (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
#!/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

if [[ $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