Find the answer to your Linux question:
Results 1 to 6 of 6
Hello, I would like to configure Heartbeat 2 in order to allowing the execution of a specific script at the statuts changing. In other words, I would like to execute ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2009
    Posts
    4

    Heartbeat - Execute a script at status switching


    Hello,

    I would like to configure Heartbeat 2 in order to allowing the execution of a specific script at the statuts changing. In other words, I would like to execute /etc/ha.d/script_backup.sh when Heartbeat status becoming Backup and /etc/ha.d/script_master.sh when Heartbeat status becoming Master.

    As instance, Carp (and Ucarp) work by default thanks this. I don't know exactly Heartbeat configuration system, but I think it is more focus on resources failover (where resources can be a service, an IP address, a daemon, etc.).

    Just for information, I use Conntrack (and Conntrackd) with Heartbeat... Not with Keepalive.

    Thanks for any help
    S.

  2. #2
    Linux Newbie
    Join Date
    Feb 2009
    Posts
    101
    do you install heartbeat-ldirectord package?
    if you want to change master server and startup some resource example service, ip, daemon, so you have to use ldirectord servcies. it's easy for use.

    vi /etc/ha.d/ldirector.cf
    ## servername #### startup your ip address ### startup your daemon
    master.station.com IPaddr::61.1.1.1/24/eth1:0 httpd

  3. #3
    Just Joined!
    Join Date
    Feb 2009
    Posts
    4
    Thank you signmem. Actually resources switching work well on my two firewalls. I can for example share an IP thanks Heartbeat's resource switching.

    But I would like to execute a script when Heartbeat become Master, and an other script when Heartbeat become Slave. I believe it's possible using Heartbeat options but I don't know which...

  4. #4
    Linux Newbie
    Join Date
    Feb 2009
    Posts
    101
    try to write one script your self.
    example.

    using dead loop script.
    monitor your flooping ip link. if change, so runing script.

    else, write script into /etc/rc.d/init.d <-- try to because one service ...

  5. #5
    Just Joined!
    Join Date
    Feb 2009
    Posts
    4
    Thank for your replay. But I do not understand, sorry. Anyway I'm continuing to search.

  6. #6
    Linux Newbie
    Join Date
    Feb 2009
    Posts
    101
    do you setup flooping ip ? like this

    vi /etc/ha.d/ldirector.cf
    ## servername #### startup your ip address ### startup your daemon
    master.station.com IPaddr::61.1.1.1/24/eth1:0 httpd

    then if your computer become master... ip -> 61.1.1.1/24 would link up.

    use this script:
    #!/bin/bash
    while [ 3 -eq 4 ]
    do

    ip=`ifconfig eth1:0 | grep Mask | awk '{print $2}' | awk -F: '{print $2}'`
    if [ $ip != "61.1.1.1" ]
    then
    post your scripts here.
    fi.

    done

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •