Advertisement
Guest User

Untitled

a guest
Mar 15th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. cd /home/myuserroot/
  4.  
  5. S3CONF=/home/myuserroot/.s3conf
  6.  
  7. BUCKET=offsite.mydomain.net
  8.  
  9. DB_BASE=db_
  10. DB_USER=username
  11. DB_PWD=password
  12.  
  13. NOW=$(date +%Y%m%d)
  14.  
  15. DB_GLOBAL=db_global
  16.  
  17. #
  18.  
  19. cd /home/myuserroot/s3sync/s3backup
  20.  
  21. # Backup the global DB
  22.  
  23. touch $DB_GLOBAL.backup$NOW.sql.gz
  24.  
  25. mysqldump -u $DB_USER -p$DB_PWD $DB_GLOBAL | gzip -9 > $DB_GLOBAL.backup$NOW.sql.gz
  26.  
  27. # Now on to the 255 other dbs
  28.  
  29. for i in {1..255}
  30. do
  31. touch $DB_BASE$(printf "%s" ""$i" "16" o p" | dc | tr '[A-Z]' '[a-z]').backup$NOW.sql.gz
  32.  
  33. mysqldump -u $DB_USER -p$DB_PWD $DB_BASE$(printf "%s" ""$i" "16" o p" | dc | tr '[A-Z]' '[a-z]') | gzip -9 > $DB_BASE$(printf "%s" ""$i" "16" o p" | dc | tr '[A-Z]' '[a-z]').backup$NOW.sql.gz
  34.  
  35. done
  36.  
  37. cd ..
  38.  
  39. /usr/local/bin/ruby s3sync.rb -r --ssl s3backup/ $BUCKET:mybackups
  40.  
  41. cd s3backup
  42.  
  43. rm -f *
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement