#!/bin/bash
SERVER_IP="47.253.147.187"
SERVER_USER="root"
SERVER_PASS="5H0FuZ:2s0q)Lx"

/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 "ls -F /www/server/nodejs/ 2>/dev/null\r"
send "find /www/server -name node -type f 2>/dev/null | grep bin/node\r"
send "echo '--- CHECKING SYSTEM INFO AGAIN ---'\r"
send "cat /etc/os-release\r"
send "exit\r"
expect eof
EOF
