[PATCH] Ensure that rsync backups are only running one at a time

Mike McGrath mmcgrath at redhat.com
Wed Mar 24 15:54:07 UTC 2010


---
 configs/db/backup-dbs |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/configs/db/backup-dbs b/configs/db/backup-dbs
index 83ed6c8..7af66fb 100755
--- a/configs/db/backup-dbs
+++ b/configs/db/backup-dbs
@@ -20,6 +20,8 @@ mv $DEST/$HOSTNAME.new $DEST/$HOSTNAME
 
 # Sync out
 for host in db01 db02 db03; do
+    # Sleep if any other rsyncs are already
+    while ssh $host "pgrep rsync" | grep -q [0-9]; do sleep 10; done
     if [ "$host" != $HOSTNAME ]; then
         su - dbbackup -c "ssh $host mkdir -p $DEST/$HOSTNAME"
         su - dbbackup -c "rsync -azr --bwlimit=5000 -e ssh $DEST/$HOSTNAME/* $host:$DEST/$HOSTNAME/"
-- 
1.6.6.1



More information about the infrastructure mailing list