"too many arguments" when running this script
when I run this script, I got "line 32: [: too many arguments"
what may be the problem? I run it like this : ./scriptname apache2 Code:
#!/bin/sh |
Code:
if [ -d /proc/$PROCESS_PID ] ; then Code:
if [ -d /proc/123 456 789 ] ; then |
Quote:
you said I need to loop through them, but I am a newbie and not familiar with shell. can I use "for...do" ? |
You can try this mod. I also made some syntax cleanups. I hope you don't mind.
Code:
#!/bin/sh |
Quote:
|
need more help
Quote:
when I run my test, I got the result of VMRSS is about 4mb, but that is the RSS of a single apache2 process. Actually, I need the total RSS or VMsize of all apache2 processes. Because I want to see when will the memory used by apache2 goes above a certain value. Is there a way to achieve this by revising the script? thanks |
try this then
Code:
#!/bin/sh |
many thanks
Quote:
thanks a lot |
Quote:
I got the data like this ElapsedTime VmSize VmRSS 14:02:15:142435792 369796 69268 14:02:17:304277575 369796 69268 14:02:19:460760757 369796 69268 14:02:21:605478630 369796 69268 14:02:23:780021002 369796 69268 14:02:25:929159430 369800 69268 14:02:28:091948031 369796 69268 14:02:30:244159809 369796 69268 ... ... ... Could this be a reasonable data? the RSS is much smaller than the Vmsize, is that because the argument I used was wrong? And I did not understand the numbers after time, 14:02:30:244159809 |
Quote:
I suggest that you check each process manually to know if the difference of those numbers are consistent. You can also modify the script to echo the values for every process: Code:
... Quote:
|
Thanks for all of you, your advices and warm supporting helped me a lot.
I will update the progress of my experiment, incase anyone is interested or doing similar things. This is another problem i encountered http://www.linuxquestions.org/questi...riment-827370/ |
Quote:
Thank you! I will check this tomorrow in the lab. |
Quote:
I tried your script, and I think maybe there is no problem. But I am think about why the VMRss is much smaller than the VMsize |
Perhaps VMsize is not really the total amount of memory allocated but only what virtually appears to the process? Sorry I also don't know much about it.
I found this pages while trying to figure it out. Just in case you find something about it. http://linuxdevcenter.com/pub/a/linu...of-memory.html http://www.mail-archive.com/c-prog@y.../msg05009.html http://www.linuxforums.org/forum/lin...id-status.html |
Quote:
|
All times are GMT -5. The time now is 08:04 AM. |