Last active
November 8, 2015 17:10
-
-
Save a-oishi/79b001506f5e7c1a1d6d to your computer and use it in GitHub Desktop.
[Heartbeat][Pacemaker]update_crm_attribute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function update_crm_attribute() { | |
| local NAME=$1 | |
| local NEW_VALUE=$2 | |
| local CMD="/usr/sbin/crm_attribute" | |
| local NODE=`uname -n` | |
| local OLD_VALUE=`timeout -s 2 2 ${CMD} --type nodes --node "${NODE}" --name "${NAME}" --query -q` | |
| if [ $? -eq 0 ]; then | |
| if [ "${OLD_VALUE}" != "${NEW_VALUE}" ]; then | |
| timeout -s 2 2 ${CMD} --type nodes --node "${NODE}" --name "${NAME}" --update "${NEW_VALUE}" | |
| fi | |
| fi | |
| } | |
| function update_crm_attribute() { | |
| local NAME=$1 | |
| local NEW_VALUE=$2 | |
| local CMD="/usr/sbin/crm_attribute" | |
| local NODE=`uname -n` | |
| timeout -s 2 2 ${CMD} --type nodes --node "${NODE}" --name "${NAME}" --update "${NEW_VALUE}" | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment