Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Set the backupdir to be an existing directory, it also
- # must be writeable by the backup-user running this script.
- BACKUPDIR="/home/backup"
- cd $BACKUPDIR
- # remove the old backup, and rename latest to yesterday.
- rm -f mysql_yesterday.tar.gz
- mv mysql_latest.tar.gz mysql_yesterday.tar.gz
- echo "Running mysql backup..."
- # do the backup...
- /usr/bin/mysqldump -A --user=root --password="r00tpassw0rd-here" --quick --extended-insert > ./mysql_latest.sql
- # tar and gzip the new sql file
- tar --remove-files -cPzf ./mysql_latest.tar.gz ./mysql_latest.sql
- echo "Done!"
- # EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement