From 649e63fa2858f23dc2d3744aab23c9345abdd4b8 Mon Sep 17 00:00:00 2001 From: Molly Lau Date: Tue, 13 Jun 2023 07:09:24 +0900 Subject: [PATCH] Update motd.sh --- Linux_reinstall/Alpine/motd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Linux_reinstall/Alpine/motd.sh b/Linux_reinstall/Alpine/motd.sh index 3657506..86ae374 100644 --- a/Linux_reinstall/Alpine/motd.sh +++ b/Linux_reinstall/Alpine/motd.sh @@ -30,7 +30,7 @@ root_usage=`df -h / | awk '/\// {print $(NF-1)}'` memory_usage=`free -m | awk '/Mem:/ { total=$2; used=$3 } END { printf("%3.1f%%", used/total*100)}'` [[ `free -m | awk '/Swap/ {print $2}'` == "0" ]] && swap_usage="0.0%" || swap_usage=`free -m | awk '/Swap/ { printf("%3.1f%%", $3/$2*100) }'` -usersnum=$(expr $(users | wc -w) + 1) +usersnum=`netstat -anp | grep -i "sshd: [a-z]" | grep -i "established" | grep -iw 'tcp\|tcp6' | wc -l` time=`uptime | grep -ohe 'up .*' | sed 's/,/\ hours/g' | awk '{ printf $2" "$3 }'` processes=`ps aux | wc -l` localip=`ip -4 addr show | grep -wA 5 "eth0" | grep -wv "lo\|host" | grep -w "inet" | grep -w "scope global*\|link*" | head -n 1 | awk -F " " '{for (i=2;i<=NF;i++)printf("%s ", $i);print ""}' | awk '{print$1}' | cut -d'/' -f1`