Last active
May 27, 2016 20:35
-
-
Save javierwilson/65619ffb1b48116d6a54747c1e6ec23b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BACKUP_DIR="/var/lib/mysql/backup" | |
if [ -n "`pidof mysqld`" ] && [ -f "/var/lib/mysql/.my.cnf" ]; then | |
mkdir -p $BACKUP_DIR | |
chown mysql $BACKUP_DIR | |
# backup datqabases | |
# please create /var/lib/mysql/.my.cnf | |
# [mysqldump] [mysql] | |
# user=mysql | |
# password=secret | |
runuser -c 'mysql -Bse "SHOW DATABASES"|xargs -i sh -c "mysqldump --opt {} > /backup/data/mysql/{}.mysql"' mysql | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment