import pexpect, time c = pexpect.spawn('ssh -q -o StrictHostKeyChecking=no root@210.16.161.214', encoding='utf-8', timeout=30) c.expect('password:') c.sendline('XHR521yhf') c.expect('[$#]') # Kill old script if still running c.sendline('pkill -f deploy_velobase 2>/dev/null; echo KILLED') c.expect('[$#]') print('CLEANUP:', c.before.strip()[-200:]) # Start pnpm install in background (this takes time too) c.sendline('cd /www/wwwroot/velobase-harness && nohup pnpm install --frozen-lockfile > /tmp/pnpm_install.log 2>&1 & echo PNPM_PID=$!') c.expect('[$#]') print('PNPM:', c.before.strip()[-200:]) # Start docker pull in background c.sendline('nohup docker pull postgres:16 > /tmp/pg_pull.log 2>&1 & echo PG_PULL_PID=$!') c.expect('[$#]') print('PG_PULL:', c.before.strip()[-200:]) time.sleep(5) # Check both c.sendline('tail -5 /tmp/pnpm_install.log 2>/dev/null; echo "==="; tail -3 /tmp/pg_pull.log 2>/dev/null') c.expect('[$#]') print('PROGRESS:', c.before.strip()[-1000:]) c.sendline('exit')