Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Awk resource script

By: a guest on Nov 17th, 2012  |  syntax: Bash  |  size: 0.30 KB  |  views: 118  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. for i in $(awk -F: '{print $2}' /etc/trueuserdomains); do top -bn 1 -u "$i"|awk '/^[0-9]/ {sumCpu +=$9; sumRam += $10;} END {if ((sumCpu > 0) || (sumRam > 0)) print "User '$i':\t\tTotal %RAM: ", sumRam, "\t\tTotal %CPU: ", sumCpu; else print "User '$i' is not showing resource usage";}'; done |sort -nk 5