Forum Discussion

jack_39736's avatar
jack_39736
Icon for Nimbostratus rankNimbostratus
Oct 29, 2009

shell script to determine Active node in cluster

I am trying to write a shell script for the F5 that will run in CRON to check to see if the device is active in the cluster before doing a "bp config sync".

 

 

When I run "set" from the shell, I see that the command:

 

 

echo $(getPromptStatus)

 

 

will tell me weather the device is active or standby because this is set in the environment.

 

 

The problem is, when I try to echo this value within a a shell script, it doesn't have a value. I also tried echoing other environmental variables that are set in the shell but they don't work from a shell script.

 

 

Can anyone point me in the right direction with this?

 

 

thanks

 

 

Jack

2 Replies

  • Hi Jack,

     

     

    Can you try ps1 instead?

     

     

    cat status.bash

     

     

    !/bin/bash

     

    echo "ps1: `ps1`";

     

    echo "\$((getPromptStatus)): $((getPromptStatus))";

     

     

    bash status.bash

     

    ps1: Active

     

    $((getPromptStatus)): 0

     

     

    Aaron