Skip to content

Instantly share code, notes, and snippets.

@koichiro
Created May 17, 2012 05:58
Show Gist options
  • Save koichiro/2716835 to your computer and use it in GitHub Desktop.
Save koichiro/2716835 to your computer and use it in GitHub Desktop.
#!/bin/sh
period=3
archive_path='/var/backups/mysql'
filename=mysql-`date +%Y%m%d`
mysqldump --opt --password=pass -h host -P 3306 -u user database > $archive_path/$filename.sql
gzip $archive_path/$filename.sql
find $archive_path -mtime +3 -name "*.gz" | xargs rm -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment