Advertisement
Guest User

Untitled

a guest
Aug 1st, 2017
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # This file will run a backup of your desired MySQL database and
  4. # remove any backups older than 7 days.
  5. #
  6. # If you'd like to preserve backups for longer than a week, like say
  7. # 2 weeks, then set the '-mtime' value from ' 7' to ' 14'.
  8. #
  9. # NOTE: Make sure to create a 'backups' folder in the root of your
  10. # account and replace USERNAME, PASSWORD, and DATABASENAME with
  11. # the appropriate values.
  12.  
  13. FILENAME=/users/home/intellect/backups/intellect_production_`date " %Y-%m-%d"`.gz
  14. TEXTFILE=/users/home/intellect/scripts/daily_backup_message.txt
  15.  
  16. /usr/local/bin/mysqldump --opt --skip-add-locks --user=intellect --password=NOES intellect_production | gzip > $FILENAME
  17. cd /users/home/intellect/backups/
  18. /usr/bin/find *.gz -mtime 7 -delete
  19. mutt -a $FILENAME -s "Nightly backup of intellect's production data" knewter intellect@gmail.com < $TEXTFILE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement