From: root Date: Tue, 8 Aug 2017 23:00:31 +0000 (+0100) Subject: etc/profile.d/sys.sh X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=2a6eb375d63e3b3fbca3c5b483074c28d2ee26dd;p=nb.git etc/profile.d/sys.sh --- diff --git a/etc/profile.d/sys.sh b/etc/profile.d/sys.sh index 98717123..e413f946 100644 --- a/etc/profile.d/sys.sh +++ b/etc/profile.d/sys.sh @@ -32,8 +32,17 @@ sys_activity() { free -hm | sed 's/^/ /' echo - echo 'Top ips:' - cat "$tmp.netstat" | tail -n +2 | awk '$5~/^[0-9]/{gsub(/:.*/,"",$5);print $5}' | sort | uniq -c| sed 's/^ *//'|sort -nr -k 1 |head | sed 's/^/ /' + echo 'Top ips conns:' + cat "$tmp.netstat" \ + | tail -n +2 \ + | awk '$5~/^[0-9]/{gsub(/:.*/,"",$5);print $5}' \ + | sort \ + | uniq -c \ + | sed 's/^ *//' \ + | sort -nr -k 1 \ + | head \ + | sed 's/^/ /' \ + ; echo echo 'dmesg:' @@ -59,8 +68,10 @@ sys_watch() { local opt="$@" [ -z "$opt" ] && opt="-d" - export -f sys_activity - #watch --no-title $opt sys_activity - watch --no-title $opt bash -c "sys_activity" + shopt -s expand_aliases; + export -f $(typeset -f | awk '/^[a-z]+[a-zA-Z0-9_]+ \(\)/{print $1}') + watch --no-title $opt sys_activity +# NB 08.08.17 export -f sys_activity +# NB 08.08.17 watch --no-title $opt bash -c "sys_activity" }