Use `ss` instead of the deprecated `netstat`.
This commit is contained in:
parent
f0d3126c30
commit
566450407e
4
dynmotd
4
dynmotd
|
@ -54,9 +54,9 @@ service_info() {
|
|||
for PORT in ${PORT_LIST}; do
|
||||
MSG="${MSG}${MAGENTA}+ "
|
||||
# If a port listen
|
||||
if (netstat -lnt|grep -m1 ${PORT} > /dev/null); then
|
||||
if (ss -lutn|grep -m1 ":${PORT}" > /dev/null); then
|
||||
# Example: "tcp/127.0.0.1:25"
|
||||
MSG="${MSG}${GREEN}$(netstat -lnt|grep -m1 ${PORT}|awk '{print $1"/"$4}')${RESET} "
|
||||
MSG="${MSG}${GREEN}$(ss -lutn|grep -m1 ":${PORT}"|awk '{print $1"/"$5}')${RESET} "
|
||||
else
|
||||
# Example: "22: NOT LISTENING"
|
||||
MSG="${MSG}${REDB}${PORT}: NOT LISTENING${RESET} "
|
||||
|
|
Loading…
Reference in New Issue