Cron Job Management ?

8 posts / 0 new
Last post
#1 Fri, 04/08/2011 - 23:41
Anonymous

Cron Job Management ?

Hi ,

I have been getting Over-Load Average Reports every day and as I could not find a solution, I asked my server supplier.

This was their reply:

"I went over your last few load average reports and identified the commands from your cron schedule that were using the most CPU. I changed these commands to have a lower priority when they run."

I have just looked in WebMin at the Edit Cron Job page and I do not see any place to change the priority.

How can I see what they have done and how can I make such changes ?

Is that sonething that I can not do in WebMin/VirtualMin ?

Obviously I want to see what priorities my cron jobs have been set to, and make changes in the future so I can keep the work load balanced.

Thanks.

David.

Sat, 04/09/2011 - 08:56
andreychek

You can make a command run with a lower priority by adding a "nice" command before it.

So if this is the CPU intensive command you're running:

./my_cpu_intensive_command

You can "nice" it by doing this:

nice -n 19 ./my_cpu_intensive_command

Fri, 04/15/2011 - 06:44
Davvit

Hi,

I can see that when I am running my auto responder to send out member newsletters , the awstats also runs and "takes over" the processor

This is what shows on the "Running Processes Module" in WebMin:

17094 40.5 % 04:40 /usr/bin/perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=expert-world ... 11192 14.8 % 04:28 php -q /home/guru54gt5/public_html/im/auto_send_news_mem.php

So can I make awstats less processor greedy ?

Thanks.

Fri, 04/15/2011 - 10:34
andreychek

Yup, you can use the "nice" command I described above for that. Just edit the cron job, and put the nice command in front of the awstats line.

-Eric

Fri, 04/15/2011 - 12:34
Davvit

Thanks for your reply.

I looked in the cron job list and noticed that the awstats cron jobs look like this: /etc/webmin/virtualmin-awstats/awstats.pl expert-world.com

which is differen from the process that was running at the time.

It happened again so I looked the "Running Processes" in WebMin and I get this list.

19712 23.6 % 04:48 /usr/bin/perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=new-arbitrag ...

20062 23.0 % 04:49 /usr/libexec/webmin/proc/index_user.cgi

1192 15.8 % 04:28 php -q /home/guru54gt5/public_html/im/auto_send_news_mem.php

All the other processes are 0 or under 2%

So is the awstats.pl and the index_user.cgi that are running here being triggered by my newsletter script ( auto_send_news_mem.php ) or was it a coincidence that they are running together ?

My newsletters often refer to a post in my forum, so the last thing I want is the forum being down when my newsletter goes out.

If the awstats is not a cron job in this case, how can I give it a lower priority ?

What does /usr/libexec/webmin/proc/index_user.cgi do anyway ?

Thanks for your help.

Fri, 04/15/2011 - 15:01
andreychek

This program here:

/usr/libexec/webmin/proc/index_user.cgi

That's what runs every time you view the running processes in Webmin. It's what determines what processes are running and shows them to you.

So that's only running because you're trying to view running processes :-)

To avoid that, you could use something like "top" from the command line, or "ps auxw", in order to see what's running.

The "awstats.pl" program you're seeing appears to be because someone (or something) is trying to view the awstats info for one of your websites.

-Eric

Sat, 04/16/2011 - 02:11
Davvit

Hello,

Thanks again :)

I put the nice in front of my newsletter sender script cron job with the intention of making it "nice" ( rather than greedy )and letting the forum to function.

Like this: nice php -q /home/guru54gt5/public_html/im/auto_send_news_mem.php

I hope that is correct ?

May be it should be : php nice -q /home/guru54gt5/public_html/im/auto_send_news_mem.php

But you did say put it "in front", so I did. If its wrong please advise.

Anyway, I also have a break in the script: it rests every 100 emails for 2 minutes, but that was there before.

Good news is, it seems to be ok now :)

BTW what does this do:

7907 54.9 % 00:00 /usr/bin/perl /usr/libexec/webmin/virtual-server/bw.pl

It is taking up a big chunk of the processor

Thanks

Sat, 04/16/2011 - 09:05
andreychek

Well, check out the example I offered above... the "nice" program takes an argument :-)

The parameter you'd pass in tells it how nice (or un-nice) to be.

In your case, you'd probably want something like this:

nice -n 19 php -q /home/guru54gt5/public_html/im/auto_send_news_mem.php

You can get more details on what "nice" does by running "man nice" from the command line, or by checking this online man page here:

http://linux.die.net/man/1/nice

Topic locked