From 1c02c71424263761147345e5cb220879d76adc28 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Mon, 2 Nov 2020 06:45:11 -0500 Subject: [PATCH] Add process owners report to motd --- home/lib/login_functions.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/home/lib/login_functions.sh b/home/lib/login_functions.sh index 7635e5d..6b01d49 100644 --- a/home/lib/login_functions.sh +++ b/home/lib/login_functions.sh @@ -549,6 +549,26 @@ motd() { echo + echo 'Process owners' + ps -eo user \ + | awk ' + NR > 1 { + count_by_user[$1]++ + total++ + } + + END { + for (user in count_by_user) + print count_by_user[user], total, user + } + ' \ + | sort -n -k 1 -r \ + | bar_gauge -v num=1 -v ch_left=' ' -v ch_right=' ' -v ch_blank=' ' \ + | column -t \ + | indent "${indent_unit}" + + echo + echo 'Loggers' awk ' { -- 2.20.1