LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   crontab high CPU (https://www.linuxquestions.org/questions/linux-software-2/crontab-high-cpu-99323/)

teeno 10-02-2003 03:24 AM

crontab high CPU
 
Hi All,

Is it normal for crontab to use a lot of CPU? On my box it is using about 95% CPU most of the time.

Thank you,
Peter

jailbait 10-02-2003 08:17 PM

"Is it normal for crontab to use a lot of CPU? On my box it is using about 95% CPU most of the time."

I don't thing that this is normal. Check to make sure that you are not executing something once a minute that you meant to execute once a day or some such. Or possibly some chrontab initiated command is going into a loop and never quitting.


___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites

electron_lemon 10-02-2003 08:23 PM

Normal? That depends on what cron is doing.

Open a terminal and run `ps -ef --sort c` and tell me what the bottom few lines say.

Also, tell me what `grep cron /var/log/syslog` says.

This will speak volumes about what's going on.

teeno 10-03-2003 03:43 AM

Hi,

Thank you for your replies.

The most frequent job that is executed is /sbin/rmmod -as. Which runs every ten minutes.

Here is the output from ps:

root 16751 1 0 Oct02 ? 00:00:00 ncpd -u apache -g
apache 17348 13855 0 04:02 ? 00:00:00 /usr/sbin/httpd
apache 17349 13855 0 04:02 ? 00:00:00 /usr/sbin/httpd
apache 17350 13855 0 04:02 ? 00:00:00 /usr/sbin/httpd
apache 17351 13855 0 04:02 ? 00:00:00 /usr/sbin/httpd
apache 17354 13855 0 04:02 ? 00:00:00 /usr/sbin/httpd
apache 17355 13855 0 04:02 ? 00:00:00 /usr/sbin/httpd
apache 17356 13855 0 04:02 ? 00:00:00 /usr/sbin/httpd
apache 17359 13855 0 04:02 ? 00:00:00 /usr/sbin/httpd
root 17871 13674 0 08:28 pts/1 00:00:00 ps -ef --sort c
root 17855 13715 0 08:23 ? 00:00:00 kedit -caption Text
mysql 17668 876 0 07:43 ? 00:00:08 /usr/sbin/mysqld --
root 17757 13715 0 08:15 ? 00:00:02 kwrite -caption
mysql 17679 876 0 07:58 ? 00:00:09 /usr/sbin/mysqld --
mysql 17646 876 0 07:15 ? 00:00:30 /usr/sbin/mysqld --
root 17865 8110 1 08:27 pts/1 00:00:00 [bandwidthd <defun
root 14715 14714 99 Sep19 ? 13-17:58:25 crontab -u root -e


I have no syslog file (not sure why) but this is what the cron log says:

Oct 3 07:00:00 localhost CROND[17629]: (root) CMD (/usr/local/bin/webalizer -c /etc/webalizer.squid.conf)

Oct 3 07:00:00 localhost CROND[17630]: (root) CMD (/usr/local/bin/webalizer -c /etc/webalizer.conf)

Oct 3 07:01:01 localhost CROND[17635]: (root) CMD (run-parts /etc/cron.hourly)

Oct 3 07:10:00 localhost CROND[17641]: (root) CMD ( /sbin/rmmod -as)

Oct 3 07:20:00 localhost CROND[17654]: (root) CMD ( /sbin/rmmod -as)

Oct 3 07:30:00 localhost CROND[17660]: (root) CMD ( /sbin/rmmod -as)

Oct 3 07:40:00 localhost CROND[17666]: (root) CMD ( /sbin/rmmod -as)

Oct 3 07:50:00 localhost CROND[17673]: (root) CMD ( /sbin/rmmod -as)

Oct 3 08:00:00 localhost CROND[17689]: (root) CMD ( /sbin/rmmod -as)

Oct 3 08:00:00 localhost CROND[17690]: (root) CMD (/usr/local/bin/webalizer -c /etc/webalizer.squid.conf)

Oct 3 08:00:00 localhost CROND[17691]: (root) CMD (/usr/local/bin/webalizer -c /etc/webalizer.conf)

Oct 3 08:01:00 localhost CROND[17697]: (root) CMD (run-parts /etc/cron.hourly)

Oct 3 08:10:00 localhost CROND[17729]: (root) CMD ( /sbin/rmmod -as)

Oct 3 08:20:00 localhost CROND[17786]: (root) CMD ( /sbin/rmmod -as)

Oct 3 08:30:00 localhost CROND[17874]: (root) CMD ( /sbin/rmmod -as)


Thank you for your help,

Peter

teeno 10-03-2003 03:57 AM

I just realized that its crontab using all the CPU not crond.

root 14715 14714 99 Sep19 ? 13-17:58:25 crontab -u root –e

Have you any idea why this could be?

Should I just kill it?

Just another quick question, why don’t I have a syslog file?

Cheers,
Peter

electron_lemon 10-03-2003 11:33 PM

Well, rmmod is for unloading unused kernel modules, and your cron has it running every 10 minutes, which is WAY too much. Set it to run every 2-4 hours instead.

Another option would be to set cron to run rmmod with very low priority, so that it only uses CPU time not used by any other app. To do this, have cron run `/bin/nice -19 /sbin/rmmod`.

To change the behavior of cron, search files in /var/spool/cron, /etc/cron.d and search /etc/crontab for lines containing `/sbin/rmmod` and replace them with the line above.

As for your crontab app using cpu, the command `crontab -u root -e` just edits root's crontab. I don't know why it's running, so kill it.

BTW, different distros divide up logfiles differently. I use Mandrake 9.1, which happens to use /var/log/syslog. I'm pretty sure redhat does, too. Most likely you run a different distro, and in that case you should just look in /var/log/messages, which is the catch-all file.

teeno 10-06-2003 02:22 AM

Thank you for your help. Everything is working fine now.

Cheers,
Peter

electron_lemon 10-06-2003 06:28 AM

No problem!

Later,
-electron_lemon


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