Advertisement
Guest User

Untitled

a guest
Aug 10th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #!/bin/bash
  2. # Database credentials
  3. user="root"
  4. password="xxx2015"
  5. host="127.0.0.1"
  6. db_name="historico"
  7. backup_path="/backups/mensual"
  8.  
  9. date=$(date +"%d-%b-%Y")
  10.  
  11. #permisos por defecto
  12. umask 177
  13.  
  14. mysqldump --user=$user --password=$password --routines --host=$host $db_name > $backup_path/$db_name-$date.sql
  15. bzip2 $backup_path/$db_name-$date.sql
  16. chmod 655 $backup_path/$db_name-$date.sql.bz2
  17. rm $backup_path/$db_name-$date.sql
  18.  
  19. #borro backups de mas de 35 dias
  20. find $backup_path/* -mtime +35 -exec rm {} \;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement