Files
yuyueguahao/scripts/deploy-v3-simplify.exp
2026-07-05 14:43:34 +08:00

30 lines
956 B
Plaintext
Executable File

#!/usr/bin/expect -f
# 部署 home/hospital 简化版 + admin 轮播图上传
# 用法: expect deploy-v3-simplify.exp
set timeout 60
set password "Szgt888."
set host "124.221.67.199"
set user "root"
set remote_dir "/opt/yuyueguahao"
# 1. 上传 admin
puts "\n>>> STEP 1: 上传 admin/app.js..."
spawn scp admin/app.js ${user}@${host}:${remote_dir}/admin/app.js
expect {
"password:" { send "$password\r" }
"yes/no" { send "yes\r"; exp_continue }
}
expect eof
# 2. 验证接口 (无需重启,前端代码 + admin 都是静态资源,只要后端有接口)
puts "\n>>> STEP 2: 验证接口..."
spawn ssh ${user}@${host} "curl -s 'http://localhost:3000/api/v1/banners?enabled=true' | head -c 800; echo ''; echo '---hosp-images---'; curl -s 'http://localhost:3000/api/v1/hospital-images?enabled=true' | head -c 800"
expect {
"password:" { send "$password\r" }
"yes/no" { send "yes\r"; exp_continue }
}
expect eof
puts "\n>>> DEPLOY DONE"