summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/myth_mtc.py
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2015-02-19 18:16:16 (GMT)
committerBritney Fransen <brfransen@gmail.com>2015-02-19 18:16:16 (GMT)
commit8de064f6e96f960cdbfe6868d9957a4613f704df (patch)
tree4e73a420991733450d013529c0fee60e0365297a /abs/core/LinHES-system/myth_mtc.py
parent0374b16f1e15ba1819b62bd5a6e0076ac7b243d0 (diff)
parent6fde8cd5e74f0840e01988e743464fe91c0a28f8 (diff)
downloadlinhes_pkgbuild-8de064f6e96f960cdbfe6868d9957a4613f704df.zip
linhes_pkgbuild-8de064f6e96f960cdbfe6868d9957a4613f704df.tar.gz
linhes_pkgbuild-8de064f6e96f960cdbfe6868d9957a4613f704df.tar.bz2
Merge branch 'testing'
Diffstat (limited to 'abs/core/LinHES-system/myth_mtc.py')
-rwxr-xr-xabs/core/LinHES-system/myth_mtc.py35
1 files changed, 21 insertions, 14 deletions
diff --git a/abs/core/LinHES-system/myth_mtc.py b/abs/core/LinHES-system/myth_mtc.py
index b1ec75d..8a08c05 100755
--- a/abs/core/LinHES-system/myth_mtc.py
+++ b/abs/core/LinHES-system/myth_mtc.py
@@ -1,13 +1,11 @@
#!/usr/bin/python2
import sys, subprocess
-import optparse
import re
import socket
import os
import datetime,time
import shlex
sys.dont_write_bytecode = True
-import idle
try:
from MythTV import MythBE
@@ -30,7 +28,7 @@ def optimize():
result = cursor.fetchall()
except:
print "\n%s Problem getting tables from the database" %(get_timestamp())
- return
+ return 1
ops=["REPAIR","OPTIMIZE","ANALYZE"]
for row in result:
ctable=row[0]
@@ -38,6 +36,7 @@ def optimize():
print " %s %s" %(op,ctable)
cmd= "%s table %s" %(op,ctable)
cursor.execute(cmd)
+ return 0
def cleanup_inuseprograms():
fourHoursAgo=datetime.datetime.today() - datetime.timedelta(hours=4)
@@ -60,18 +59,26 @@ def bail_if_another_is_running():
def run_stuff():
print "\n%s" %get_timestamp()
- if idle.main():
- print "\n#######################################"
- print "\n%s Running Optimize" %(get_timestamp())
- optimize()
+ if not subprocess.call(["/usr/bin/python2", "/usr/LH/bin/idle.py"]):
+ if ("--optimize" in sys.argv) or (len(sys.argv) == 1):
+ print "\n#######################################"
+ print "\n%s Running Optimize" %(get_timestamp())
+ if not optimize():
+ print "\nFinished Optimize"
+ else:
+ return True
- print "\n#######################################"
- print "\n%s Running Backup" %(get_timestamp())
- os.system('/usr/LH/bin/lh_system_backup_job')
+ if ("--backup" in sys.argv) or (len(sys.argv) == 1):
+ print "\n#######################################"
+ print "\n%s Running Backup" %(get_timestamp())
+ if not os.system('/usr/LH/bin/lh_system_backup_job'):
+ print "\nFinished Backup"
- print "\n#######################################"
- print "\n%s Running System Update" %(get_timestamp())
- os.system('/usr/LH/bin/lh_system_host_update')
+ if ("--update" in sys.argv) or (len(sys.argv) == 1):
+ print "\n#######################################"
+ print "\n%s Running System Update" %(get_timestamp())
+ if not os.system('/usr/LH/bin/lh_system_host_update'):
+ print "\nFinished Update"
print "\n#######################################"
continue_loop=False
@@ -86,7 +93,7 @@ ctin=True
while ctin:
cleanup_inuseprograms()
ctin=run_stuff()
- if ctin:
+ if ctin:
print "\n%s Waiting 10 minutes before trying again." %(get_timestamp())
time.sleep(600)