-
-
Save vekexasia/0c0b86919ea5b4c16557 to your computer and use it in GitHub Desktop.
Backup :)
This file contains 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
[client] | |
host = localhost | |
user = backupuser | |
password = your-password-here | |
socket = /var/run/mysqld/mysqld.sock |
This file contains 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 | |
mkdir -p ~/mysqlbackups/ | |
for i in $(mysql -Bse "show databases"); do | |
mysqldump $i > ~/mysqlbackups/$i.sql | |
done |
This file contains 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
CREATE USER 'backupuser'@'localhost' IDENTIFIED BY 'your-password-here'; | |
GRANT SELECT , | |
LOCK TABLES , | |
SHOW VIEW ON * . * TO 'backupuser'@'localhost' IDENTIFIED BY 'your-password-here' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ; |
This file contains 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
config_version 1.2 | |
snapshot_root /your/backup/folder/ | |
cmd_rsync /usr/bin/rsync | |
cmd_ssh /usr/bin/ssh | |
cmd_cp /bin/cp | |
cmd_rm /bin/rm | |
cmd_logger /usr/bin/logger | |
cmd_du /usr/bin/du | |
retain daily 7 | |
retain weekly 7 | |
retain monthly 3 | |
#client1 backups | |
backup backupper@client1:/home/backupper/mysqlbackups client1/ | |
backup backupper@client1:/etc client1/ +rsync_long_args=--rsync-path='sudo rsync' | |
backup backupper@client1:/var/www client1/ +rsync_long_args=--exclude '/stats/*' --exclude '/log/*' --exclude '/phptmp/*' --exclude '/cache/*' --rsync-path='sudo rsync' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment