LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Crond Taking Almost 100% Processor Time (https://www.linuxquestions.org/questions/linux-software-2/crond-taking-almost-100-processor-time-278844/)

ngwasuma 01-17-2005 09:45 AM

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?

rjlee 01-17-2005 10:25 AM

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`
(assuming that mrtg is the name of the running process as displayed in top)

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).

ngwasuma 01-26-2005 03:57 AM

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
or do i just add the command at the top of my cron tasks?

I beleive there must be several instances of MRTG running during the
execution of the tasks.

rjlee 01-27-2005 12:00 PM

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.

ngwasuma 01-04-2006 09:05 AM

thanks rjlee


All times are GMT -5. The time now is 06:15 PM.