Advertisement
Guest User

Untitled

a guest
Feb 28th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. @daily /bin/bash /home/backup/scripts/db_backup
  2.  
  3. #!/bin/bash
  4.  
  5. # Sets the properties and folders to be backed up
  6. host_name=admin@the_host.com
  7. db_name=the_db_name
  8. db_backup_folder_at_host="~/db_backup"
  9.  
  10. # Dumps the mysql database
  11. { # Try
  12. ssh ${host_name} "mysqldump ${db_name} > ${db_backup_folder_at_host}/backup$(date +%F_%R).sql" &&
  13. echo "$(date) SUCCESS! mysqldump of database"
  14. } || { # Catch
  15. echo "$(date) FAILURE! mysqldump of database"
  16. }
  17.  
  18. [mysqldump]
  19. user=USERNAME
  20. password=PASSWORD
  21. host=MYSQLSERVER
  22.  
  23. 0 0 * * * /bin/bash /home/backup/scripts/db_backup
  24.  
  25. # m h dom mon dow user command
  26. 17 * * * * root cd / && run-parts --report /etc/cron.hourly
  27. 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
  28. 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
  29. 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
  30. #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement