Crond Taking Almost 100% Processor Time
I am a newbie in Linux. Recently I setup MRTG to monitor several workstations. I added commands for querying SNMP data to run in 5 min interval using crontab (as shown below:)
*/5 * * * * /usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/bin/comp1.cfg logging /var/log/mrtg.log */5 * * * * /usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/bin/comp2.cfg logging /var/log/mrtg.log */5 * * * * /usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/bin/comp3.cfg logging /var/log/mrtg.log (There are up to 26 computers) Now, when the tasks are being excecuted, I cant do anything else on the linux 7.2 machine coz its like the tasks take 100% of the processor time. Is there something I can do to have my key strokes given priority? |
You need to increase the niceness value of the running tasks.
To do this, you can either start the tasks using the nice command (eg through a script), or use this (started from cron at the same time) to change the niceness values after the processes have started running (note that these are backticks, not apostrophies): Code:
renice +19 `/sbin/pidof mrtg` You could also look into recompiling your kernel to improve overall system efficiency, or creating multiple swap partitions on different physical drives (if system swapping is causing this latency). |
Do i have to add this command to all the the lines as shown below?
Code:
*/5 * * * * renice +19 `/sbin/pidof /usr/local/mrtg-2/bin/mrtg` /usr/local/mrtg-2/bin/comp1.cfg logging /var/log/mrtg.log I beleive there must be several instances of MRTG running during the execution of the tasks. |
This one line will renice all of your mrtg processes, assuming that they are running when the renice command executes. You don't need to specify it multiple times.
|
thanks rjlee
|
All times are GMT -5. The time now is 06:15 PM. |