summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/myth_mtc.py
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2015-02-04 22:21:37 (GMT)
committerBritney Fransen <brfransen@gmail.com>2015-02-04 22:21:37 (GMT)
commitf398554642cf0eea2331762687a4e85c916909af (patch)
treed8b79dd06bb498cadf2fd24ef21234dce00ecc73 /abs/core/LinHES-system/myth_mtc.py
parentb96ea1f1faba3420cd4a07f172e664146e8c1d31 (diff)
downloadlinhes_pkgbuild-f398554642cf0eea2331762687a4e85c916909af.zip
linhes_pkgbuild-f398554642cf0eea2331762687a4e85c916909af.tar.gz
linhes_pkgbuild-f398554642cf0eea2331762687a4e85c916909af.tar.bz2
LinHES-system: myth_mtc improvments
Diffstat (limited to 'abs/core/LinHES-system/myth_mtc.py')
-rwxr-xr-xabs/core/LinHES-system/myth_mtc.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/abs/core/LinHES-system/myth_mtc.py b/abs/core/LinHES-system/myth_mtc.py
index b1ec75d..dcb3886 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,24 @@ 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"
- 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