Files
yuyueguahao/scripts/deploy-v5-phone-tabbar.exp
2026-07-05 14:43:34 +08:00

42 lines
1.5 KiB
Plaintext
Executable File

#!/usr/bin/expect -f
# 部署 Phase 8: upload 修复 + tabBar 图标 + 电话直拨 + 后台电话设置
set timeout 60
set password "Szgt888."
set host "124.221.67.199"
set user "root"
set remote_dir "/opt/yuyueguahao"
puts "\n>>> STEP 1: 上传后端"
foreach f {
server/src/modules/upload/route.js
server/src/modules/config/route.js
server/src/modules/config/service.js
server/src/index.js
} {
spawn scp $f ${user}@${host}:${remote_dir}/$f
expect { "password:" { send "$password\r" } "yes/no" { send "yes\r"; exp_continue } }
expect eof
}
puts "\n>>> STEP 2: 上传 admin"
foreach f {
admin/app.js
admin/index.html
} {
spawn scp $f ${user}@${host}:${remote_dir}/$f
expect { "password:" { send "$password\r" } "yes/no" { send "yes\r"; exp_continue } }
expect eof
}
puts "\n>>> STEP 3: 确保 server/uploads 存在"
spawn ssh ${user}@${host} "mkdir -p ${remote_dir}/server/uploads && chmod 755 ${remote_dir}/server/uploads && ls -la ${remote_dir}/server/uploads/ && echo '---RESTART---' && pm2 restart yuyueguahao-api 2>&1 && sleep 2"
expect { "password:" { send "$password\r" } "yes/no" { send "yes\r"; exp_continue } }
expect eof
puts "\n>>> STEP 4: 验证"
spawn ssh ${user}@${host} "echo '---site---' && curl -s 'http://localhost:3000/api/v1/config/site' && echo '' && echo '---upload test (with valid auth)---'"
expect { "password:" { send "$password\r" } "yes/no" { send "yes\r"; exp_continue } }
expect eof
puts "\n>>> DONE"