check_node.sh 605 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. SERVER_IP="47.253.147.187"
  3. SERVER_USER="root"
  4. SERVER_PASS="5H0FuZ:2s0q)Lx"
  5. /usr/bin/expect <<EOF
  6. set timeout 30
  7. spawn ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP
  8. expect {
  9. "password:" { send "$SERVER_PASS\r" }
  10. "yes/no" { send "yes\r"; exp_continue }
  11. }
  12. expect "#"
  13. send "echo '--- CHECKING NODEJS ---'\r"
  14. send "which node\r"
  15. send "which npm\r"
  16. send "ls -F /www/server/nodejs/ 2>/dev/null\r"
  17. send "find /www/server -name node -type f 2>/dev/null | grep bin/node\r"
  18. send "echo '--- CHECKING SYSTEM INFO AGAIN ---'\r"
  19. send "cat /etc/os-release\r"
  20. send "exit\r"
  21. expect eof
  22. EOF