Skip to content

Instantly share code, notes, and snippets.

@craigw
Created January 14, 2010 11:48
Show Gist options
  • Save craigw/277099 to your computer and use it in GitHub Desktop.
Save craigw/277099 to your computer and use it in GitHub Desktop.
#! /bin/bash
# make sure /etc/mysql.passwd is chmod go-wrx.
# and chmod root:root.
PASSWORD=`cat /etc/mysql.passwd`
NICE='/usr/bin/nice -n 20'
CWD=`/bin/pwd`
UMASK=`umask`
MYSQLDUMP="/usr/bin/mysqldump -u root --password='${PASSWORD}'"
DUMPFILE="/var/backups/mysql.sql"
umask u=r,go-wrx
$NICE $MYSQLDUMP --all-databases > ${DUMPFILE}
umask $UMASK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment