Skip to content

Instantly share code, notes, and snippets.

@Tab3r
Created June 4, 2013 10:23
Show Gist options
  • Save Tab3r/5704985 to your computer and use it in GitHub Desktop.
Save Tab3r/5704985 to your computer and use it in GitHub Desktop.
Test the memory usage in a summary, in Ubuntu
#!/bin/bash
echo "---- APACHE ----"
ps -ylC apache2 | awk '{x += $8;y += 1} END {print "Total Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}'
echo "---- JBOSS ----"
ps -ylC java | awk '{x += $8;y += 1} END {print "Total Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}'
echo "-- POSTGRESQL --"
ps -ylC postgres | awk '{x += $8;y += 1} END {print "Total Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment