Synchronize Database Automation scripts

Source: Internet
Author: User

Synchronize Database Automation scripts #! /Bin/sh www.2cto.com read-p "Please keyin your ssh host:"-t 30 host_ipread-p "Please keyin your ssh user: "-t 30 usernameread-p" Please keyin your ssh pass: "-t 30 passwordread-p" Please keyin your sync table list, separated by spaces: "-t 30 table_list datetime = 'date + % Y % m % d % H % M % s' src _ file ="/tmp/data _ $ datetime. SQL "tar_file ="/tmp/data_1_datetime.tar.gz "mysqldump-h127.0.0.1-uroot-ppass databa Se_name $ table_list> $ src_filetar czvf $ tar_file $ src_file./expect_scp.sh $ host_ip $ username $ password $ tar_file expect_scp.sh code www.2cto.com #! /Tools/bin/expectset timeout 10 set host [lindex $ argv 0] set username [lindex $ argv 1] set password [lindex $ argv 2] set src_file [lindex $ argv 3] # set dest_file [lindex $ argv 4] spawn scp $ src_file $ username @ $ host: /home/$ username detail CT {"(yes/no )? "{Send" yes \ n "CT" * assword: "{send" $ password \ n "}" * assword: "{send" $ password \ n "}}your CT" 100% "your CT eof

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.