Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # This file will run a backup of your desired MySQL database and
- # remove any backups older than 7 days.
- #
- # If you'd like to preserve backups for longer than a week, like say
- # 2 weeks, then set the '-mtime' value from ' 7' to ' 14'.
- #
- # NOTE: Make sure to create a 'backups' folder in the root of your
- # account and replace USERNAME, PASSWORD, and DATABASENAME with
- # the appropriate values.
- FILENAME=/users/home/intellect/backups/intellect_production_`date " %Y-%m-%d"`.gz
- TEXTFILE=/users/home/intellect/scripts/daily_backup_message.txt
- /usr/local/bin/mysqldump --opt --skip-add-locks --user=intellect --password=NOES intellect_production | gzip > $FILENAME
- cd /users/home/intellect/backups/
- /usr/bin/find *.gz -mtime 7 -delete
- 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