From a48d9f6377248f4c5b552f31df2e98f05a5ae6d4 Mon Sep 17 00:00:00 2001
From: Tom Culliton <culliton@x2.(none)>
Date: Mon, 26 Jan 2009 00:01:44 -0500
Subject: Added some logic to wait for the DB to start responding after
 restart.

---
 abs/core-testing/LinHES-system/bin/backupcommon | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/abs/core-testing/LinHES-system/bin/backupcommon b/abs/core-testing/LinHES-system/bin/backupcommon
index 9b75db3..39a62e9 100644
--- a/abs/core-testing/LinHES-system/bin/backupcommon
+++ b/abs/core-testing/LinHES-system/bin/backupcommon
@@ -359,7 +359,15 @@ check_files_and_tables () {
 }
 
 stop_mysqld () { $SV stop mysql ; }
-start_mysqld () { $SV start mysql ; }
+start_mysqld () {
+    $SV start mysql
+    for t in 1 2 4 8 ; do
+        ready=$(mysql_cmd 'select 1 from dual' 2>/dev/null)
+        [ "$ready" = "1" ] && break
+        sleep "$t"
+    done
+    [ "$ready" != "1" ] && echo "Error, DB not available after 15 seconds!"
+}
 
 stop_mythbackend () { $SV stop mythbackend ; }
 start_mythbackend () { $SV start mythbackend ; }
-- 
cgit v0.12

