diff --git a/plugins/system/cpubyuser b/plugins/system/cpubyuser index 424bc2cf..c2522233 100755 --- a/plugins/system/cpubyuser +++ b/plugins/system/cpubyuser @@ -7,6 +7,8 @@ # [cpubyuser] # env.USERS root yann # +# If env.USERS is set to ALL, count all logged in users. +# # root and yann being a list of the users to monitor. # You need to also make sure that awk is installed # @@ -70,6 +72,10 @@ if [ "$1" = "config" ]; then exit fi +if [ "$USERS" = "ALL" ]; then + USERS=$( w | awk '{ print $1 }' ) +fi + top -b -n 1 | tail -n +8 | \ awk -v USERS="$USERS" ' { if ($2 != "USER") CPU_USER[$2]+=$9 }