User Tools

Site Tools


linux:bash:cara-monitor-port-down-up

BASH: Cara Memonitor Port Online atau Offline

Berikut ini adalah script untuk memonitor port down atau online yang biasanya kita lakukan dengan telnet.

SERVER=gitlab.com
PORT=22
nc -z -v -w5 $SERVER $PORT
result1=$?

#Do whatever you want

if [  "$result1" != 0 ]; then
  echo  'port 22 is closed'
else
  echo 'port 22 is open'
fi

Selamat mencoba.

sumber : https://stackoverflow.com/questions/4922943/test-if-remote-tcp-port-is-open-from-a-shell-script

Layanan

Harga Domain .COM | Harga Domain .ID | Shared Hosting | Email Hosting | MySQL Hosting |
linux/bash/cara-monitor-port-down-up.txt · Last modified: 2021/09/18 09:24 by kbadmin