summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/myth_mtc.py
diff options
context:
space:
mode:
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