Advanced Recovery Switchover Hook Script

Hi all, I am hoping someone has experience with Advanced Recovery Switchover Hook Scripts. The documentation seems to be lacking or inaccurate.

I’ve configured the script to /opt/FreePBX-advr-script/advr-hook.sh, synced the configuration to the secondary server and verified that the asterisk user has permissions to run it on both servers. All it is doing currently is writing out the arguments passed to the script. The only time it seems to run is when the primary server becomes active the script runs on the primary server. When it runs there are no arguments (the documentation states “Execute post switchover hooks to run custom third party script with an “START” argument.”) The adv_recovery.log and adv_recovery_hook.log files only mention the hook script when I save the configuration, but not when switching servers.

I am unsure if I should keep barking up this tree, or to just write my own script that constantly checks which server is active and does what I need it to do when it detects a change. Is there a way from the command line to get the current status of advanced recovery (ie. active or standby)?

Any help would be appreciated.

I’ve tried to look into the GraphQL API, but it looks like only the “servicestatus” (ie. is the service running) is query-able, not the server status (ie. is this server Active or Standby). If I’m wrong, I’d love to be corrected. :slight_smile:

At this point I believe I’m going to have to write a script to log into the FreePBX webpage, scrape the Advanced Recovery page, and act based on that information. That is the only solution I can find.