Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Database credentials
- user="xxx"
- password="xxx"
- host="xxx"
- db_name="xxxx"
- # Other options
- backup_path="/data/backup/mysql"
- d=$(date +"%F-%T")
- # Set default file permissions
- umask 177
- # Dump database into SQL file
- mysqldump --user=$user --password=$password $db_name > $backup_path/$db_name-$d.sql
- # Delete files older than 30 days
- find $backup_path/* -mtime +30 -exec rm {} \;
Add Comment
Please, Sign In to add comment