Files
sanguo_vnpy/archive/2026-04-29-cleanup/scripts/deployment/nas_ssh_deploy.exp
T
2026-04-29 20:15:43 +08:00

53 lines
837 B
Plaintext
Executable File

#!/usr/bin/expect -f
# NAS SSH 自动化部署脚本
# 使用 expect 自动输入密码
set timeout 600
set nas_ip "192.168.2.154"
set nas_user "cfdaily"
set nas_pass "Ccf7561523"
spawn ssh $nas_user@$nas_ip
expect {
"Password:" {
send "$nas_pass\r"
}
"password:" {
send "$nas_pass\r"
}
"Are you sure you want to continue connecting" {
send "yes\r"
exp_continue
}
timeout {
puts "SSH连接超时"
exit 1
}
}
expect "$ "
send "cd /volume1/stock/sanguo_vnpy\r"
expect "$ "
send "ls -la\r"
expect "$ "
send "chmod +x start_on_nas.sh\r"
expect "$ "
send "./start_on_nas.sh\r"
expect {
"✅ sanguo_vnpy 启动成功" {
puts "\n\n部署成功!"
}
timeout {
puts "\n\n命令执行中,请稍后查看..."
}
}
interact