#!/usr/bin/expect set timeout -1 set host "156.225.27.52" set port "5204" set user "root" set password $env(DEPLOY_SSH_PASSWORD) set local_script "remote_deploy_dreamomni2.sh" set remote_script "/root/remote_deploy_dreamomni2.sh" puts "Starting deployment to $host..." # Step 1: Upload the deployment script puts "Uploading deployment script..." spawn scp -P $port $local_script $user@$host:$remote_script expect { "Are you sure you want to continue connecting" { send "yes\r" exp_continue } "password:" { send "$password\r" } } expect eof # Step 2: Execute the script remotely puts "Executing deployment script on remote server..." spawn ssh -p $port $user@$host "bash $remote_script" expect { "password:" { send "$password\r" } } # Keep the session open to show output until the remote command finishes expect eof puts "Deployment process finished."