summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/myth_mtc.py
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2011-12-25 22:45:19 (GMT)
committerJames Meyer <james.meyer@operamail.com>2011-12-25 22:45:19 (GMT)
commit0a759a5c99085665905a76637dc257cb15902975 (patch)
tree3b7bf92520042b30ed8a9b9d66b9752948bbf872 /abs/core/LinHES-system/myth_mtc.py
parent0952df12cba0f4782cafc0e752ffc841afb509c5 (diff)
downloadlinhes_pkgbuild-0a759a5c99085665905a76637dc257cb15902975.zip
linhes_pkgbuild-0a759a5c99085665905a76637dc257cb15902975.tar.gz
linhes_pkgbuild-0a759a5c99085665905a76637dc257cb15902975.tar.bz2
myth_mtc.py:
Fix path for backup and restore jobs. All encase db calls in try/except to avoid the script failing when the bindings cannot connect refs #804
Diffstat (limited to 'abs/core/LinHES-system/myth_mtc.py')
-rwxr-xr-xabs/core/LinHES-system/myth_mtc.py59
1 files changed, 38 insertions, 21 deletions
diff --git a/abs/core/LinHES-system/myth_mtc.py b/abs/core/LinHES-system/myth_mtc.py
index 1ed6c88..6fd53a7 100755
--- a/abs/core/LinHES-system/myth_mtc.py
+++ b/abs/core/LinHES-system/myth_mtc.py
@@ -10,18 +10,22 @@ import datetime,time
-#try:
-from MythTV import MythBE
-mythtv = MythBE()
-#except:
-# mythtv = None
+try:
+ from MythTV import MythBE
+ mythtv = MythBE()
+except:
+ mythtv = None
#print mythtv.db.getSetting( 'Theme', socket.gethostname())
def optimize():
- cursor = mythtv.db.cursor()
- cursor.execute("SHOW tables")
- result = cursor.fetchall()
+ try:
+ cursor = mythtv.db.cursor()
+ cursor.execute("SHOW tables")
+ result = cursor.fetchall()
+ except:
+ print "Problem getting tables from database"
+ return
ops=["REPAIR","OPTIMIZE","ANALYZE"]
for row in result:
ctable=row[0]
@@ -32,7 +36,10 @@ def optimize():
def upcoming_check():
- upcoming = mythtv.getUpcomingRecordings()
+ try:
+ upcoming = mythtv.getUpcomingRecordings()
+ except:
+ return True
try:
show=str(upcoming[0])
show=show.strip()
@@ -52,10 +59,14 @@ def upcoming_check():
def schemalock_check():
- c = mythtv.db.cursor()
- c.execute("select count(*) from schemalock")
- results=c.fetchone()
- schemalock=results[0]
+ try:
+ c = mythtv.db.cursor()
+ c.execute("select count(*) from schemalock")
+ results=c.fetchone()
+ schemalock=results[0]
+ except:
+ return True
+
if schemalock == 0:
return True
else:
@@ -63,9 +74,12 @@ def schemalock_check():
return False
def job_check():
- c = mythtv.db.cursor()
- c.execute("select count(*) from jobqueue where status = 4")
- results=c.fetchone()
+ try:
+ c = mythtv.db.cursor()
+ c.execute("select count(*) from jobqueue where status = 4")
+ results=c.fetchone()
+ except:
+ return True
jobs= results[0]
if jobs == 0 :
return True
@@ -75,9 +89,12 @@ def job_check():
def in_use():
- c = mythtv.db.cursor()
- c.execute("select count(*) from inuseprograms")
- results=c.fetchone()
+ try:
+ c = mythtv.db.cursor()
+ c.execute("select count(*) from inuseprograms")
+ results=c.fetchone()
+ except:
+ return True
prginuse=results[0]
if prginuse == 0 :
return True
@@ -119,10 +136,10 @@ def run_stuff():
optimize()
print "Running backup"
- os.system('/usr/LH/bin/backup_job')
+ os.system('/usr/LH/bin/lh_system_backup_job')
print "Running system_update"
- os.system('/usr/LH/bin/update_system')
+ os.system('/usr/LH/bin/lh_system_host_update')
continue_loop=False
else:
continue_loop=True