lovart3/upload_and_deploy.exp
2025-12-17 20:15:18 +08:00

48 lines
1.3 KiB
Plaintext
Executable File

#!/usr/bin/expect
set timeout -1
set host "156.225.27.52"
set port "5204"
set user "root"
set password "Jsjj@8888"
set remote_script "/root/remote_setup.sh"
# 1. Upload Setup Script (small file, scp is fine)
puts "--> Uploading setup script..."
spawn scp -P $port remote_setup.sh $user@$host:$remote_script
expect {
"password:" { send "$password\r" }
"yes/no" { send "yes\r"; exp_continue }
}
expect eof
# 2. Upload Code (DreamOmni2 folder)
puts "--> Uploading DreamOmni2 Code..."
spawn rsync -avz -e "ssh -p $port" DreamOmni2 $user@$host:/root/ai-projects/
expect {
"password:" { send "$password\r" }
"yes/no" { send "yes\r"; exp_continue }
}
expect eof
# 3. Upload Model (DreamOmni2_Model folder) - USING RSYNC FOR RESUME SUPPORT
puts "--> Uploading Model Weights (supporting resume)..."
# -a: archive mode, -v: verbose, -z: compress, -P: partial/progress
spawn rsync -avzP -e "ssh -p $port" DreamOmni2_Model $user@$host:/root/
expect {
"password:" { send "$password\r" }
"yes/no" { send "yes\r"; exp_continue }
}
# Expect EOF or timeout (timeout is -1 so it waits forever)
expect eof
# 4. Execute Setup Script
puts "--> Executing remote configuration..."
spawn ssh -p $port $user@$host "bash $remote_script"
expect {
"password:" { send "$password\r" }
}
expect eof
puts "All operations completed successfully."