Abaixo está um exemplo básico. Existem muitos exemplos para executar scripts mysqldump, eu colei em um rápido.
#!/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"