Files
ai-exchange/scripts/deploy_with_expect.exp
T
2026-04-24 13:39:01 +08:00

29 lines
797 B
Plaintext
Executable File

#!/usr/bin/expect -f
set timeout 120
set host "192.168.3.90"
set user "root"
set password "123456"
set local_path "/Users/yuqei/AI Exchange"
set remote_path "/root/deploy/ai-ict"
spawn ssh -o StrictHostKeyChecking=accept-new $user@$host "mkdir -p $remote_path"
expect {
"*assword:*" { send "$password\r" }
eof
}
expect eof
spawn rsync -az --delete --exclude ".git" --exclude ".venv" --exclude "__pycache__" --exclude "tests" -e "ssh -o StrictHostKeyChecking=accept-new" "$local_path/" "$user@$host:$remote_path/"
expect {
"*assword:*" { send "$password\r"; exp_continue }
eof
}
expect eof
spawn ssh -o StrictHostKeyChecking=accept-new $user@$host "cd $remote_path && docker compose down && docker compose up -d --build"
expect {
"*assword:*" { send "$password\r" }
eof
}
expect eof