[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] MySQL watchdog



Hi Graham,


Can anyone recommend a script to ensure that the MySQL demon is running, and
one that can email me if it stops please? Any pointers to 'Howto' type
material for this newbie would be very welcome.


I have no idea if such a solution exists.

I think you might want to whip up a small script that checks if MySQL is running (via ps, for instance) and that starts MySQL for you if it's down *and* mails you. You could run this perhaps every 5 minutes via cron.

I've done a similar thing in the past, although very rugged and maybe plain stupid, but it worked. ;-)

It was based on the output of 'ps -[whatever, can't remember]|grep -i mysql|grep -v grep' or something similar. Put that in a variable and check if the variable is empty. If so, MySQL is down. Then issue whatever script you use to start MySQL and you're running again (unless of course, MySQL doesn't start at all...).

HTH... Nico