-1

I have a few state change scripts executed and they seem to be called on when I view the service status but they never run. If I execute the script manually it works fine. Any thoughts? Using Deb9.

user206106
  • 85
  • 1
  • 9
  • vrrp_instance VI_1 { notify /scripts/change.sh state MASTER interface enp0s3 notify_master /scripts/master.sh virtual_router_id 50 priority 200 advert_int 1 virtual_ipaddress { 10.2.0.50 } } – user206106 Jun 27 '19 at 16:08

1 Answers1

1

Please add more details like how you are trying to execute. take a look on below example which check if file contain up or not. This is generic way.

vrrp_script <name> {
  script "ping -c1 google.com"
  interval 2                   
  weight 0                     
}
track_script {
      <name>  #Call the name
  }

For more reference please check this link https://www.keepalived.org/manpage.html

Edit: because too much chars from same man page. Double check your parameters that is situation it will fail.

       # for ANY state transition.
       # "notify" script is called AFTER the notify_* script(s) and
       # is executed with 4 additional arguments after the configured
       # arguments provided by Keepalived:
       #   $(n-3) = "GROUP"|"INSTANCE"
       #   $(n-2) = name of the group or instance
       #   $(n-1) = target state of transition (stop only applies to instances)
       #            ("MASTER"|"BACKUP"|"FAULT"|"STOP")
       #   $(n)   = priority value
       #   $(n-3) and $(n-1) are ALWAYS sent in uppercase, and the possible
       #
       # strings sent are the same ones listed above
       #   ("GROUP"/"INSTANCE", "MASTER"/"BACKUP"/"FAULT"/"STOP")
       # (note: STOP is only applicable to instances)
       notify <STRING>|<QUOTED-STRING> [username [groupname]]
asktyagi
  • 2,401
  • 1
  • 5
  • 19
  • vrrp_instance VI_1 { notify /scripts/change.sh state MASTER interface enp0s3 notify_master /scripts/master.sh virtual_router_id 50 priority 200 advert_int 1 virtual_ipaddress { 10.2.0.50 } } – user206106 Jun 27 '19 at 18:03