Last active
August 29, 2015 14:01
-
-
Save bvogel/4d96dbaab859a33bd157 to your computer and use it in GitHub Desktop.
/usr/local/cron/backup_buddy_production_db.sh
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/sh | |
| date_today=`date +%Y-%m-%d` | |
| year_month_today=`date +%Y-%m` | |
| ssh rails-deploy@buddy.buddyandselly.com "mysqldump -h 93.92.128.20 -u xxx -pxxx buddy_production | bzip2 -c > buddy/backups/buddy.dump.$date_today.sql.bz2" | |
| if [ ! -d "/share/ReRe-Server/IT/Buddy_Development/Database-Backup/$year_month_today" ]; then | |
| mkdir /share/ReRe-Server/IT/Buddy_Development/Database-Backup/$year_month_today | |
| chown admin.everyone /share/ReRe-Server/IT/Buddy_Development/Database-Backup/$year_month_today | |
| chmod 770 /share/ReRe-Server/IT/Buddy_Development/Database-Backup/$year_month_today | |
| fi | |
| scp rails-deploy@buddy.buddyandselly.com:~/buddy/backups/buddy.dump.$date_today.sql.bz2 /share/ReRe-Server/IT/Buddy_Development/Database-Backup/$year_month_today/ | |
| ssh rails-deploy@buddy.buddyandselly.com "rm buddy/backups/buddy.dump.$date_today.sql.bz2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment