Added cron job for running myth.find_orphans.pl into mythtv::backend.
This commit is contained in:
parent
78362bc146
commit
8b949bcf26
2 changed files with 58 additions and 3 deletions
43
mythtv/files/mythorphans
Executable file
43
mythtv/files/mythorphans
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/bin/sh
|
||||
|
||||
# read in configs
|
||||
. /etc/mythtv/mysql.txt
|
||||
MYTHVERSION="`rpm -q --queryformat='%{VERSION}\n' mythtv-docs`"
|
||||
|
||||
if [ -z "${LocalHostName}" ]; then
|
||||
LocalHostName=`hostname`
|
||||
fi
|
||||
|
||||
# check if we have storage directories with at least 1 video
|
||||
mysql -h "${DBHostName}" -u"${DBUserName}" -p"${DBPassword}" -s \
|
||||
-e "SELECT COUNT(*) FROM recorded WHERE hostname='${LocalHostName}'" \
|
||||
"${DBName}" | egrep -q "^[1-9][0-9]*\$" || exit 0
|
||||
|
||||
# find orphans and print stats if found
|
||||
perl /usr/share/doc/mythtv-docs-${MYTHVERSION}/contrib/myth.find_orphans.pl \
|
||||
--dbhost="${DBHostName}" \
|
||||
--database="${DBName}" \
|
||||
--user="${DBUserName}" \
|
||||
--pass="${DBPassword}" | awk '
|
||||
BEGIN {
|
||||
data = "";
|
||||
ok = 0;
|
||||
}
|
||||
{
|
||||
if (/[0-9]* orphaned thumbnails with no corresponding recording/) {
|
||||
if ($1 > 0) {
|
||||
ok = 1;
|
||||
}
|
||||
}
|
||||
if (/[0-9]* unknown files using [0-9]*/) {
|
||||
if ($1 > 0) {
|
||||
ok = 1;
|
||||
}
|
||||
}
|
||||
data = data "\n" $0
|
||||
}
|
||||
END {
|
||||
if (ok) {
|
||||
print data;
|
||||
}
|
||||
}'
|
Loading…
Add table
Add a link
Reference in a new issue