Skip to content

Instantly share code, notes, and snippets.

@tumf
Created December 19, 2011 09:06
Show Gist options
  • Select an option

  • Save tumf/1496199 to your computer and use it in GitHub Desktop.

Select an option

Save tumf/1496199 to your computer and use it in GitHub Desktop.
mysql backup
#!/bin/sh
# 0 4 * * * /path/to/backup >/dev/null 2>&1
dbname=mysql
dbhost=localhost
dbuser=root
backup_dir=/tmp
mysqlbackupfile=${backup_dir}/${dbname}-`date +%Y%m%d%H%M%S`.sql
mysqldump ${dbname} -h ${dbhost} -u ${dbuser}| gzip > ${mysqlbackupfile}.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment