Problem creating a script using Rss for total consumption memory
Hi,
i want to create a script that opens firefox,loads some urls from a txt file and then record some statistics such as the amount of instances that belongs to firefox and the total memory consumption(in MB) every 0.5 sec.i want the statistics to be written and saved in file.i know how to find the memory consumption ( grep /proc/"pid"/status VmRSS ) but i dont know how to do it every 0,5 sec and then write&save on file. thank you for your time!! |
There is a utility named "watch" which you can use to run your script every 0.5 seconds. See its manual page for the details. You can write the output to a file using a redirection
But to convert it to RSS needs a bit more work, maybe with perl. |
Thank you for your answer,but maybe you misundestood me.With Rss i mean Resident set size,not rss feed.if you can help me now i would appreciate it
|
Ok. How far have you gotten with "watch" and redirecting its output to a file?
|
Do you want to start firefox,open the URLS,then shut firefox down completely every .5 second?
|
Quote:
How about reading the "Question Guidelines" first?? We will be glad to help you...but if you want it 'now', then you need to hire someone. We volunteer our time here, so telling us to help you 'now' is plain rude. Also, 'help' means that YOU do work, and tell us where you're stuck, not post what you want and expect us to hand you a script. |
Quote:
|
Quote:
i am stuck on the last part with the recording function.Basically i dont know how to do it every 0.5 sec. Thank you for your time |
Not a problem. Looks like you probably meant something like:
Quote:
|
If you can show the script that does the first part, we can probably help you out with the second part.
|
Quote:
|
Quote:
Quote:
Quote:
Can you please post some example output and illustrate what you have tried which gets you to this output. Please also update and indicate if you have tried the advice from Turbocapitalist? Please note that it is difficult for persons to offer assistance for your problem if it appears that you are doing different attempts from the advice, we then have no idea which actions you are trying versus not. Turbocapitalist also gave you a link for redirection which will help you with channeling the output of your command into a log file. However if you have used a different command, or are writing a program to perform these actions, we have no real idea because you aren't posting any specifics about your attempts. |
firefox &
while read line; do firefox --new-tab "$line" sleep 10s done < /home/zografos/Desktop/urls.txt pid=$! sleep 30s ps aux | grep firefox | awk '{print $2}' sudo kill $pid sleep 10s ps aux | grep firefox | awk '{print $2}' sudo kill -2 $pid here is the 1st part of script i forgot to mention that have to kill instances of firefox. |
First question. Isn't:
Code:
pid=$! |
Code:
#Read the file by line |
All times are GMT -5. The time now is 04:43 AM. |