Script for Memory Usage??
I have a JAVA Processes running and all I need to find out what total memory it is utilising.If its usage exceed 500 MB (My memory is 1GB)it should throw error or report the % memory Usage.
IS there any script which can display the same?? |
You can get the memory usage of a process with a command like
Code:
ps -C command-name -o rss= |
and percentage of 'used physical memory' by
Quote:
|
The command threw:
vjs@vjs:~$ ps -C java -o rss= 393504 What is this???What does rss means? LEmme me tel you issue in detail. I am tring to write a script which shouldnt allow Java application to exceed 500MB irrespective of total RAM Size. It Means if RAM is 30GB also,it should retrict it to 500MB. How can I do this? All i tried a attempt: Code:
mem=`ps aux | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr | grep java |cut -c1-4`; Code:
vjs@vjs:~$ ./memscript.sh Pls help |
Quote:
|
If you want to restrict memory in Java processes, shouldn't you use the -Xms/-Xmc startup parameters instead of scripting something?
|
Quote:
Code:
-Xmsn |
All times are GMT -5. The time now is 05:50 AM. |