is-leader

Summary

Print application leadership status.

Options

Flag

Default

Usage

--format

smart

Specify output format (json|smart|yaml)

-o, --output

Specify an output file

Examples

LEADER=$(is-leader)
if [ "${LEADER}" == "True" ]; then
  # Do something a leader would do
fi

Details

is-leader prints a boolean indicating whether the local unit is guaranteed to be application leader for at least 30 seconds. If it fails, you should assume that there is no such guarantee.