Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @daily /bin/bash /home/backup/scripts/db_backup
- #!/bin/bash
- # Sets the properties and folders to be backed up
- host_name=admin@the_host.com
- db_name=the_db_name
- db_backup_folder_at_host="~/db_backup"
- # Dumps the mysql database
- { # Try
- ssh ${host_name} "mysqldump ${db_name} > ${db_backup_folder_at_host}/backup$(date +%F_%R).sql" &&
- echo "$(date) SUCCESS! mysqldump of database"
- } || { # Catch
- echo "$(date) FAILURE! mysqldump of database"
- }
- [mysqldump]
- user=USERNAME
- password=PASSWORD
- host=MYSQLSERVER
- 0 0 * * * /bin/bash /home/backup/scripts/db_backup
- # m h dom mon dow user command
- 17 * * * * root cd / && run-parts --report /etc/cron.hourly
- 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
- 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
- 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
- #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement