Skip to content

Instantly share code, notes, and snippets.

@fideloper
Created October 20, 2011 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fideloper/1302670 to your computer and use it in GitHub Desktop.
Save fideloper/1302670 to your computer and use it in GitHub Desktop.
bash shell file for daily database backup - Run as CRON job
#/bin/bash
/usr/bin/mysqldump --user=DB_USER --password='DB_PASSWORD' --databases DB_NAME | gzip > /path/to/backup/DB_NAME-`date +%Y%m%d%H%M`.sql.gz
find /path/to/backup -name "*.gz" -mtime +60 -exec /bin/rm {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment