[Mysql] ftp automatically uploads mysql backup files

Source: Internet
Author: User
Tags mysql backup

[Mysql] ftp automatically uploads mysql backup files

In the previous article, mysql daily backup shell script provided the script to back up data to the local device using mysqldump. The following is the script to transmit the backup file to the remote server using ftp. Of course, scp and rsync can also be used.

#! /Bin/sh ############################# orangleliu # upload a specified file through ftp # centos usage (date formatting on mac is not very easy) # note that ftp must be switched to the binary mode ############################# uploaded the server sets HOST = 'ftp .wificdn.com 'USER = 'ddd' PASSWD = 'er # backp.2 '# name of the file to be uploaded and deleted, retain for 10 days BASE_DIR = "/home/backup" BACKUP_LOG = "$ {base_dir}/mysql_backup.log" DBNAME = "radius" FILE_UPLOAD = "$ {DBNAME}-$ (date +" % y-% m-% d "2.16. SQL .gz" FILE_DELE = "$ {DBNAME}-$ (date-d"-10 day "+" % Y-% m-% d "2.16. SQL .gz "echo" ftp upload $ FILE_UPLOAD finished at $ (date + '% Y-% m-% d % H: % M: % s') ">" $ BACKUP_LOG "ftp-n $ HOST <

  

   

Important Notes:

The environment used here is that centosftp must be switched to binary mode.

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.