From 566450407e7f5bde1423ded21067b36e2dcdbc41 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Mon, 2 Feb 2015 09:44:39 +0100 Subject: [PATCH] Use `ss` instead of the deprecated `netstat`. --- dynmotd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dynmotd b/dynmotd index 84e7aa8..bc0a110 100755 --- a/dynmotd +++ b/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} "