Created
April 5, 2012 21:03
-
-
Save aeurielesn/2314169 to your computer and use it in GitHub Desktop.
Backup through FTP
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 -e | |
# | |
#Define dumpfile name | |
MYSQLBACKUP= /tmp/dbackup | |
#Perform MySQL dump | |
#Replace appropriate USER, PASSWORD and paths to mysqldump, socket, etc. | |
#Drop in you preferred method - tar versus gzip, etc. | |
/usr/bin/mysqldump --all-databases -S /tmp/mysql.sock -uUSER -pPASSWORD | gzip -c > $MYSQLBACKUP | |
#FTP Backup file to remote FTP server | |
#Replace 192.1681.1.1 with IP address of remote server | |
#Replace USER & PASSWORD | |
echo "open 192.168.1.1 | |
user USER PASSWORD | |
verbose | |
cd /some/directory/on/remote/server | |
bin | |
prompt | |
mput $MYSQLBACKUP | |
close | |
quit" | ftp -n >> /tmp/somelogfile | |
#Remove the file post transfer. Need to be sure it was ftp'd first | |
rm -f "MYSQLBACKUP" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment