[mysql]ftp automatically upload MySQL backup files

Source: Internet
Author: User
Tags mysql backup

The previous MySQL daily backup shell script gives a script that uses mysqldump to back up to the local, followed by a script that uses FTP to transfer the backup file to the remote server. Of course, can also use Scp,rsync and so on plan.

#!/bin/sh#############################orangleliu#ftp upload the specified file#centos Use (the formatting of dates on Mac is not very good)#注意ftp一定要切换成二进制模式#############################上传的服务器设置host=' ftp.wificdn.com 'User=' DDD 'Passwd=' ER#BACKP.2 '#上传和要删除的文件名称, reserved for 10 daysBase_dir="/home/backup"backup_log="${base_dir}/mysql_backup.log"Dbname="radius"File_upload="${dbname}-$ (date +" )%Y-%m-%d"). sql.gz"file_dele="${dbname}-$ (date-d"-TenDay" +"%Y-%m-%d"). sql.gz"Echo"ftp upload $FILE _upload finished at $ (date + '%Y-%m-%d %H :%M:%s') ">>"$BACKUP _log"Ftp-n$HOST<<end_scriptquote USER$USERQuote PASS$PASSWDBinarylcd$BASE _dirPromptmput$FILE _uploadMdelete$FILE _deleQuitend_scriptExit 0

Key issues to note:

    • The environment used here is CentOS
    • FTP must be switched to binary mode

Copyright NOTICE: This article is Orangleliu (http://blog.csdn.net/orangleliu/) original article, the article reproduced please declare.

[mysql]ftp automatically upload MySQL backup files

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.