Your cron line:
0 * * * * /home/you/mysqlcheck
Or if it's in /etc/crontab
0 * * * * root /home/you/mysqlcheck
And the script:
#!/bin/sh
# on error send e-mail to
#
adminmail="[EMAIL PROTECTED]"
# or /usr/bin/safe_mysqld, etc.
#
restartCommand="/etc/rc.d/init.d/mysqld start"
if [ ! "`ps auwx|grep safe_mysqld|grep -v grep`" ]
then
echo "can't find mysql process, restarting server\!" \
| mail $adminmail
$restartCommand
fi
if [ ! "`mysqladmin -uroot -prootpassword ping | grep -x 'mysqld is
alive'`" ]
then
echo "mysqld status check failed, restarting server\!" \
| mail $adminmail
$restartCommand
fi
If you wanted to be really clever you could have it actually
connect and run a test query or something
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, December 15, 2001 7:56 AM
To: [EMAIL PROTECTED]
Subject: Monitor Mysql Server
Hello,
Sorry for the OT,.. but I was hoping someone may suggest a script that
can monitor multiple mysql servers. We have two running and I would like
to setup a cron to check the servers once an hour or so to make sure it
running and if not, it would be capable of restart the server
automatically in the event someone is not available to restart it. I'm
no shell script write... strictly Perl :) Not sure this could be done
with Perl.
any suggestions would be appreciated. :)
Happy Holidays,
Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Providing Internet Solutions that work! http://www.thunder-rain.com
Tel: 1(225)686-2002
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php