Andrew Beekhof wrote:
you might also want to check out the one under source control:
  http://hg.linux-ha.org/dev/file/tip/resources/OCF/mysql.in
Hi Andrew,

Thanks a lot for this script. I have installed it and tested it already, but there was some stuff not working well.
Here is a diff with my changes:

--- mysql.new.ha-linux  (revision 49)
+++ mysql.new.ha-linux  (revision 48)
@@ -30,7 +30,7 @@
#######################################################################
# Initialization:

-. /usr/lib/heartbeat/ocf-shellfuncs
+. @hb_libdir@/ocf-shellfuncs

#######################################################################

@@ -45,7 +45,7 @@
: ${OCF_RESKEY_group="mysql"}

: ${OCF_RESKEY_log="/var/log/mysqld.log"}
-: ${OCF_RESKEY_pid="/var/run/mysqld/mysqld.pid"}
+: ${OCF_RESKEY_pid="/var/lib/mysql/mysqld.pid"}
: ${OCF_RESKEY_socket="/var/lib/mysql/mysql.sock"}

: ${OCF_RESKEY_test_user="root"}
@@ -207,7 +207,7 @@
               kill -0 $pid >/dev/null 2>&1
       fi

-       if [ $? -eq 0 ]; then
+       if $?; then

Here I got before an error on the bash like:
bash: 0: command not found


               return $OCF_SUCCESS;
       else
               ocf_log debug "MySQL not running: removing old PID file"
@@ -267,7 +267,7 @@
    #chown -R $OCF_RESKEY_user $OCF_RESKEY_datadir
    #chgrp -R $OCF_RESKEY_group $OCF_RESKEY_datadir

- $MYSQL_BINDIR/mysqld_safe --defaults-file=$OCF_RESKEY_config --pid-file=$OCF_RESKEY_pid --socket=$OCF_RESKEY_socket --datadir=$OCF_RESKEY_datadir --user=$OCF_RESKEY_user >/dev/null 2>&1 & + $MYSQL_BINDIR/safe_mysqld --defaults-file=$OCF_RESKEY_config --pid-file=$OCF_RESKEY_pid --socket=$OCF_RESKEY_socket --datadir=$OCF_RESKEY_datadir --user=$OCF_RESKEY_user >/dev/null 2>&1 &
    rc=$?

Maybe it's better to put the mysql binary into a variable, because on Fedora it's called the other way around.

So far the script was working then but there wasn't any monitoring log messages in my logfiles of heartbeat. After a while I saw, that on line 223 a variable called $OCF_CHECK_LEVEL:

219 mysql_monitor() {
220     mysql_status
221     rc=$?
222
223     if [ $OCF_CHECK_LEVEL = 0 -o $rc != 0 ]; then
224         return $rc
225     fi
226

So in that case mysql_status finds the pidfile and returns a $OCF_SUCCESS which is zero. So it should go on with the monitoring of mysql, but the variable $OCF_CHECK_LEVEL is only defined on that line no where else in the mysql script. I have found it also in ocf-shellfuncs, but i don't have a clue what it does.

So I took my script again... I know it works. But maybe you could enlightened me a bit...

Thanks,

Achim


On 1/8/07, Achim Stumpf <[EMAIL PROTECTED]> wrote:
Hi list,

I have rewritten a mysql ocf script which I found on
http://k2k.ds14.agh.edu.pl/egee-ha/mysql

Basically I corrected the exit codes and I have rewritten some functions
which i didn't like.

In my test cluster it works fine. I haven't found any mysql ocf script
shipped with your source code, so maybe you like mine.

If you have any advice, what should be changed or what else you need of
mine, so that you are able to integrate it in your sources, let me know
please.


cheers,

Achim



_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to