#!/bin/bash
SERVER_IP="45.61.60.10"
SERVER_USER="root"
SERVER_PASS="UQb9TgSwC@vwhEM"

/usr/bin/expect <<EOF
set timeout 30
spawn ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP

expect {
    "password:" { send "$SERVER_PASS\r" }
    "yes/no" { send "yes\r"; exp_continue }
}

expect "#"
send "echo '--- CHECKING NODEJS ---'\r"
send "which node\r"
send "which npm\r"
send "node -v\r"
send "npm -v\r"
send "echo '--- CHECKING SYSTEM INFO AGAIN ---'\r"
send "cat /etc/os-release\r"
send "exit\r"
expect eof
EOF
