daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Dec 29th, 2016 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. #################### SCRIPT PARA BACKUP MYSQL ####################
  4. #                                                                #
  5.  
  6.  
  7. # Definindo parametros do MySQL
  8. echo "  -- Definindo parametros do MySQL ..."
  9. DB_NAME='medigestao'
  10. DB_USER='medigestao'
  11. DB_PASS='medigestao@135'
  12. DB_PARAM='--add-drop-table --add-locks --extended-insert --single-transaction -quick'
  13.  
  14. # Definindo parametros do sistema
  15. echo "  -- Definindo parametros do sistema ..."
  16. DATE=`date +%Y-%m-%d`
  17. MYSQLDUMP=/usr/bin/mysqldump
  18. BACKUP_DIR=/apps/clientes/medigestao/public_html/medigestao/
  19. BACKUP_NAME=medigestao-$DATE.sql
  20. BACKUP_TAR=medigestao-$DATE.tar
  21.  
  22. #Gerando arquivo sql
  23. echo "  -- Gerando Backup da base de dados $DB_NAME em $BACKUP_DIR/$BACKUP_NAME ..."
  24. $MYSQLDUMP $DB_NAME $DB_PARAM -u $DB_USER -p$DB_PASS > $BACKUP_DIR/$BACKUP_NAME
  25.  
  26. # Compactando arquivo em tar
  27. echo "  -- Compactando arquivo em tar ..."
  28. tar -cf $BACKUP_DIR/$BACKUP_TAR -C $BACKUP_DIR $BACKUP_NAME
  29.  
  30. # Compactando arquivo em bzip2
  31. echo "  -- Compactando arquivo em bzip2 ..."
  32. bzip2 $BACKUP_DIR/$BACKUP_TAR
  33.  
  34. # Excluindo arquivos desnecessarios
  35. echo "  -- Excluindo arquivos desnecessarios ..."
  36. rm -rf $BACKUP_DIR/$BACKUP_NAME
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top