Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #Database login credentials - need to be changed accordingly
- dbHost="***"
- dbName="**"
- dbUser="***"
- dbPass="***"
- #How many days the backups should be kept for before being removed
- keepBackupsFor="30"
- if [ ! -d ~/additional_backups ]; then mkdir ~/additional_backups; fi
- curTime=$(date +"%m-%d-%y_%H:%M")
- mysqldump -h ${dbHost} -u ${dbUser} -p${dbPass} ${dbName} > ~/additional_backups/${curTime}-sql_backup.sql
- find ~/additional_backups -type f -ctime +${keepBackupsFor} -exec rm -f {} \;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement