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