Skip to content

Instantly share code, notes, and snippets.

@a-oishi
Last active November 8, 2015 17:10
Show Gist options
  • Select an option

  • Save a-oishi/79b001506f5e7c1a1d6d to your computer and use it in GitHub Desktop.

Select an option

Save a-oishi/79b001506f5e7c1a1d6d to your computer and use it in GitHub Desktop.
[Heartbeat][Pacemaker]update_crm_attribute
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