Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2006-10-25, 04:09 AM   #1
Doug E
Kids are great, Appu. You can teach them to hate the things you hate and they practically raise themselves now-a-days, you know, with the internet and all
 
Doug E's Avatar
 
Join Date: Mar 2005
Location: Canadeh
Posts: 197
Code To Auto Killall Mysqld

Im looking for a command that will check my server load and run the command 'killall mysqld' if the load is over a certain average. Should I be looking for cron commands to do this?
__________________
Asian Porn | Sora Aoi | Natt Kesarin
Doug E is offline   Reply With Quote
Old 2006-10-25, 09:30 AM   #2
Servhot
Kids are great, Appu. You can teach them to hate the things you hate and they practically raise themselves now-a-days, you know, with the internet and all
 
Servhot's Avatar
 
Join Date: Jan 2005
Location: Denmark
Posts: 199
Send a message via ICQ to Servhot Send a message via AIM to Servhot Send a message via Yahoo to Servhot
I would suggest you better check why the mysql load moves that high and find a solution for this or better fix the program which makes the server load
__________________
Zappu

Adult Content Provider
Servhot is offline   Reply With Quote
Old 2006-10-25, 11:07 AM   #3
cd34
a.k.a. Sparky
 
cd34's Avatar
 
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
I wouldn't condone doing a kill for that as you're likely to leave tables in a crashed state requiring a repair or at least a check before you start.

However, with that said, you could do something like:

Code:
#!/usr/bin/perl

open F,("</proc/loadavg");
($ld,$junk) = split /\./,<F>;
close F;

if ($ld >= 10) {
  `whateveryouwanttorun`;
}
If the 1 minute load average is above 10, it will run that command. Put that in cron and you should be set. However, I'll say again, and I agree with servhot, I think its a bad idea to kill the server.

Perhaps run something like

mysqladmin -uroot -ppassword processlist | mail username@domain.com

or turn on the slow query log, or do a show processlist in the mysql command line interface or phpmyadmin.

Better to find the cause than to treat the effect.
__________________
SnapReplay.com a different way to share photos - iPhone & Android
cd34 is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:45 AM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc