Add process owners report to motd
authorSiraaj Khandkar <siraaj@khandkar.net>
Mon, 2 Nov 2020 11:45:11 +0000 (06:45 -0500)
committerSiraaj Khandkar <siraaj@khandkar.net>
Mon, 2 Nov 2020 11:45:11 +0000 (06:45 -0500)
home/lib/login_functions.sh

index 7635e5d..6b01d49 100644 (file)
@@ -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 '
         {
This page took 0.025926 seconds and 4 git commands to generate.