From 10892c3e008eadbe8baf7359fa3a65fc7bb08feb Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 10 Feb 2015 14:14:33 +0000
Subject: LinHES-system: myth_mtc.cron: check if optimize ran before backup

myth_mtc.py: if optimize fails wait and try again
---
 abs/core/LinHES-system/PKGBUILD      | 6 +++---
 abs/core/LinHES-system/myth_mtc.cron | 2 +-
 abs/core/LinHES-system/myth_mtc.py   | 4 +++-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 3db2a65..2cd194f 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=8.3
-pkgrel=5
+pkgrel=6
 arch=('i686' 'x86_64')
 install=system.install
 pkgdesc="Everything that makes LinHES an automated system"
@@ -80,7 +80,7 @@ md5sums=('8415c4b2587a8a1e6a312484c1edafcb'
          'de32a1c50101265dd7f6ca5037f7a26a'
          '301884fb60521627fffd1160b2cf5181'
          '76b2637cac0452b3acdbeeb4e8a5474b'
-         'bfd41a145bec93270e21ad8d51662c48'
+         'd02ddadeb2181f90954e435842cd7f0a'
          'dc3eef2a624754e16805d72bbe488b67'
          '617af86b901538817ebdcaf646248dc5'
          '542e670e78d117657f93141e9689f54d'
@@ -132,7 +132,7 @@ md5sums=('8415c4b2587a8a1e6a312484c1edafcb'
          '410795ef9039e4c6c0484e706ecfd567'
          'eb879fee9603a05d5420d4ce8ed9e450'
          '02c810c2f47b7c4495fdacaf54189473'
-         '28ce5d884ee608b0479d4bf2a64697db'
+         'dc48a53d4e5fe27b218657ccc318d07f'
          '474d5c6883fcfffae4f199aceb3b1356'
          '8fe800181dcdf45bb7d7b36e4de8409e'
          '36bdfa8d877cea20ca3870faf08e08d5'
diff --git a/abs/core/LinHES-system/myth_mtc.cron b/abs/core/LinHES-system/myth_mtc.cron
index 0c098f1..d3dc50a 100755
--- a/abs/core/LinHES-system/myth_mtc.cron
+++ b/abs/core/LinHES-system/myth_mtc.cron
@@ -28,7 +28,7 @@ then
         fi
     fi
 
-    if ! grep -q "Finished Backup" $logFile
+    if ! grep -q "Finished Backup" $logFile && grep -q "Finished Optimize" $logFile
     then
         MYTHCONFDIR=/usr/share/mythtv unbuffer myth_mtc.py --backup | $log
         if [ $? = 0 ]
diff --git a/abs/core/LinHES-system/myth_mtc.py b/abs/core/LinHES-system/myth_mtc.py
index dcb3886..8a08c05 100755
--- a/abs/core/LinHES-system/myth_mtc.py
+++ b/abs/core/LinHES-system/myth_mtc.py
@@ -65,6 +65,8 @@ def run_stuff():
             print "\n%s Running Optimize" %(get_timestamp())
             if not optimize():
                 print "\nFinished Optimize"
+            else:
+                return True
 
         if ("--backup" in sys.argv) or (len(sys.argv) == 1):
             print "\n#######################################"
@@ -91,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)
         
-- 
cgit v0.12

