I use a simple script that does the following:

--- snip ---
mysql -e "SELECT * from table_name limit 1" db > 2>/tmp/filename
x=`cat /tmp/filename`
if [ "$x" = "" ]
then
do_nothing=1
else
## There's an issue!
echo "ERROR!"
fi
--- end snip ---

Using the re-direct of stderr is the key. the "2>/tmp/filename" sends all
error output to the /tmp/filename file. If there are no errors, the file
will be empty.

I run it as a cron job every ten minutes, and if there is an error, it pages
me.
Keeps me in the know!

-----Original Message-----
From: Sascha Kettner [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 04, 2002 5:53 AM
To: [EMAIL PROTECTED]
Subject: Watchdog für mysql in Perl?


Hi!

Short question: i want to have a perl watchdog telling me when executed
if my sql-server is running and if anything is allright with it. So if i
get any errormessage i can restart the server by remote. Has someone
done this allready? Any hint?

Thanks again and best regards

Sascha Kettner


---------------------------------------------------------------------
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 <mysql-unsubscribe-##L=##[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to