monit-general
[Top][All Lists]
Advanced

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

Re: Question about monitrc file.


From: Jovan Kostovski
Subject: Re: Question about monitrc file.
Date: Thu, 4 Oct 2007 00:06:47 +0200

On 10/2/07, alex <address@hidden> wrote:
> Note: httpd and smb are the name of startup scripts for Apache and Samba,
> respectively. Heartbeat will look for startup scripts of the same name in
> the following paths:
>      /etc/ha.d/resource.d
>      /etc/rc.d/init.d

Yes that's right, but leave the /etc/rc.d or /etc/init.d for the
"real" startup scripts ;)
Add the wrapper scripts to /etc/ha.d/resource.d

I've never tried linking the init.d scripts in  /etc/ha.d/resource.d.
Try it it may work.

Here is the wrappers script named ha-mysql that I wrote for
starting/stoping mysql
----------------------------
#!/bin/bash
exec_name=mysql
path_to_exec=/etc/init.d

start() {
       echo -n "Starting : "
       $path_to_exec/$exec_name start &&
       return
}

stop() {
       echo -n "Shutting down : "
                               killproc $exec_name
       return
}

case "$1" in
   start)
       start
       ;;
   stop)
       stop
       ;;
   *)
       echo "Usage: $0 {start|stop}"
       exit 1
       ;;
esac
-----------------------------------

It is located in /etc/ha.d/resource.d

Now you can add it to the monitrc part which monitors the mysql server
-----------------------
check process mysql_DBserver with pidfile /var/run/mysqld/mysqld.pid
start program = "/etc/ha.d/resoruce.d/ha-mysql start"
stop program = "/etc/ha.d/resoruce.d/ha-mysql stop"
if failed host 127.0.0.1 port 3306 then restart
if 2 restarts within 2 cycles then timeout
#if 2 restarts within 2 cycles then exec "/usr/sbin/monit heartbeat stop"
group Inet-Primaire
mode manual
---------------------

BR, Jovan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]