bitsCN.com
同步数据库自动化脚本
#!/bin/sh www.bitsCN.com
read -p "Please keyin your ssh host:" -t 30 host_ip
read -p "Please keyin your ssh user:" -t 30 username
read -p "Please keyin your ssh pass:" -t 30 password
read -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_$datetime.tar.gz"
mysqldump -h127.0.0.1 -uroot -ppass database_name $table_list > $src_file
tar czvf $tar_file $src_file
./expect_scp.sh $host_ip $username $password $tar_file
expect_scp.sh代码 www.bitsCN.com
#!/tools/bin/expect
set timeout 10
set host [lindex $argv 0]
友点企业网站管理系统集电脑网站、手机网站、微信三站合一,只要录入一次数据,三站数据自动同步,降低人力维护成本;共用一个管理后台,只要一个虚拟主机,有效节约空间投资。系统采用PHP进行开发,它具有操作简单、功能强大、稳定性好、易扩展、安全性强、后期维护方便等特点,可以帮您迅速、轻松地构建起一个强大专业的企业网站。
134
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
expect {
"(yes/no)?"
{
send "yes/n"
expect "*assword:" { send "$password/n"}
}
"*assword:"
{
send "$password/n"
}
}
expect "100%"
expect eof
bitsCN.com
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号