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/17 22:24 by kbadmin

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki