Skip to content

Instantly share code, notes, and snippets.

@tserong
Last active December 19, 2015 22:19
Show Gist options
  • Save tserong/6026993 to your computer and use it in GitHub Desktop.
Save tserong/6026993 to your computer and use it in GitHub Desktop.
Check if current node in a Pacemaker cluster is currently running any resources (new and improved thanks to lge on #linux-ha).
#!/bin/sh
[ -n "$(crm_mon -1 -n 2>/dev/null | sed -ne '/^Failed actions:/ q; /^Node '$(crm_node -n)':/,/^Node/ { /^Node/ d; p }')" ] \
&& echo 'this node is hosting resources' \
|| echo 'this node is slacking off, doing nothing'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment