Often, for example in an external monitor script, it is desirable for the script to execute only on the primary blade of a VIPRION cluster. Traditionally, in BIG-IP, a script has executed "tmsh show sys cluster" and then parsed the output (with "grep" and "awk") to derive a value which indicates whether it is running on the primary blade. However, there is another way to find out, using a different command ("bladectl") which runs more quickly and with less overhead than "tmsh".
How to use this snippet:
Embed this one-liner into your script, with appropriate surrounding logic. If running on the primary, it returns '1'. If running on a secondary blade, it returns '0'.