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;
|
||||||
|
}
|
||||||
|
}'
|
|
@ -27,7 +27,11 @@ class mythtv::backend {
|
||||||
$mythtv_dbname = "mythconverg"
|
$mythtv_dbname = "mythconverg"
|
||||||
}
|
}
|
||||||
|
|
||||||
package { ["mythtv-backend", "mythtv-setup", "mythtv-docs"]:
|
package { ["mythtv-backend",
|
||||||
|
"mythtv-setup",
|
||||||
|
"mythtv-docs",
|
||||||
|
"perl-DBD-MySQL",
|
||||||
|
"mysql", ]:
|
||||||
ensure => installed,
|
ensure => installed,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +67,14 @@ class mythtv::backend {
|
||||||
require => Package["mythtv-backend"],
|
require => Package["mythtv-backend"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file { "/etc/cron.daily/mythorphans":
|
||||||
|
ensure => present,
|
||||||
|
source => "puppet:///mythtv/mythorphans",
|
||||||
|
mode => 0755,
|
||||||
|
owner => root,
|
||||||
|
group => root,
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,7 +84,7 @@ class mythtv::backend {
|
||||||
#
|
#
|
||||||
class mythtv::cron inherits mythtv::backend {
|
class mythtv::cron inherits mythtv::backend {
|
||||||
|
|
||||||
package { [ "perl-MythTV", "perl-Net-UPnP", "perl-DBD-MySQL" ]:
|
package { [ "perl-MythTV", "perl-Net-UPnP" ]:
|
||||||
ensure => installed,
|
ensure => installed,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue