Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Heartbeat - Execute a script at status switching


    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/ when Heartbeat status becoming Backup and /etc/ha.d/ 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

  2. #2
    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/
    ## servername #### startup your ip address ### startup your daemon IPaddr:: httpd

  3. #3
    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. $spacer_open
  5. #4
    try to write one script your self.

    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 ...

  6. #5
    Thank for your replay. But I do not understand, sorry. Anyway I'm continuing to search.

  7. #6
    do you setup flooping ip ? like this

    vi /etc/ha.d/
    ## servername #### startup your ip address ### startup your daemon IPaddr:: httpd

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

    use this script:
    while [ 3 -eq 4 ]

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


Posting Permissions

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