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