zapeador wrote:
In that case you need a command such as the the ps ones suggested in post #3 or #4 to run from boot up to the time of "maximum load" writing to a log file so that when you get to the point of "maximum load", you can reboot and inspect the log.
A script such as the following should do it. You could write it into a file called: cpuLogger
Code:
#!/bin/sh
while :
do
ps axch -o cmd,%cpu --sort=-%cpu | head
echo "---------------------"
sleep 30s
done >> /home/<your_username>/cpuLogFile
This script will write the percentage of cpu usage of the top ten processes into the file: cpuLogFile in your home directory once every 30 seconds. You can of course use any time interval that you think best. Replace <your_username> with your user name.
Then you need to give the script file execute permissions:
You could run it thus from the directory in which it resides:
The "&" at the end will run the script in the background.
If you want to stop the script you will need to use the kill command. When you start cpuLogger it will output a process ID number on the screen like this:
Code:
[ben@owl ~]$ ./cpuLogger &
[1] 21577
To stop the script from running, run: kill 21577.
You can always find the process ID by asking ps thus:
Code:
[ben@owl ~]$ ps aux |grep cpuLogger
ben 21577 0.0 0.0 2536 1520 pts/8 S 21:47 0:00 /bin/sh ./cpuLogger
ben 21733 0.0 0.0 6288 2168 pts/8 S+ 21:49 0:00 grep --color=auto cpuLogger
But you may not need to stop the script because you'd want to know what the output is when the machine gets to maximum load, so you could let it run to the point where the machine freezes up. You could of course inspect the file at any point before that point in order to get an idea of what is happening. If it runs to the end, then reboot and inspect the file.
You could also do this whole investigation looking at the memory instead of cpu by replacing the cpu element in the primary ps command to mem, like this:
Code:
ps axch -o cmd,%mem --sort=-%mem | head
And, you would best change the script file and log file names to something like memLogger and memLogFile to keep cpu and mem outputs separate.