31ece2e99a
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
26 lines
974 B
Plaintext
Executable File
26 lines
974 B
Plaintext
Executable File
#!/usr/bin/expect -f
|
|
set timeout 300
|
|
set host "192.168.3.90"
|
|
set user "root"
|
|
set password "816301"
|
|
set archive "/tmp/ai-ict-deploy.tgz"
|
|
set remote_archive "/root/ai-ict-deploy.tgz"
|
|
set remote_path "/root/deploy/ai-ict"
|
|
|
|
proc auth {} {
|
|
expect {
|
|
"*yes/no*" { send "yes\r"; exp_continue }
|
|
"*assword:*" { send "$::password\r"; exp_continue }
|
|
eof
|
|
}
|
|
}
|
|
|
|
spawn ssh -o StrictHostKeyChecking=accept-new $user@$host "hostname && docker --version && ((docker compose version) || (docker-compose --version)) && mkdir -p $remote_path"
|
|
auth
|
|
|
|
spawn scp -o StrictHostKeyChecking=accept-new $archive $user@$host:$remote_archive
|
|
auth
|
|
|
|
spawn ssh -o StrictHostKeyChecking=accept-new $user@$host "rm -rf $remote_path/* && tar -xzf $remote_archive -C $remote_path && cd $remote_path && ((docker compose down || docker-compose down) >/dev/null 2>&1 || true) && ((docker compose up -d --build) || (docker-compose up -d --build)) && ((docker compose ps) || (docker-compose ps))"
|
|
auth
|