This site best when viewed with a modern standards-compliant browser. We recommend Firefox Get Firefox!.

Linux-HA project logo
Providing Open Source High-Availability Software for Linux and other OSes since 1999.

USA Flag UK Flag

Japanese Flag

Homepage

About Us

Contact Us

Legal Info

How To Contribute

Security Issues

This web page is no longer maintained. Information presented here exists only to avoid breaking historical links.
The Project stays maintained, and lives on: see the Linux-HA Reference Documentation.
To get rid of this notice, you may want to browse the old wiki instead.

1 February 2010 Hearbeat 3.0.2 released see the Release Notes

18 January 2009 Pacemaker 1.0.7 released see the Release Notes

16 November 2009 LINBIT new Heartbeat Steward see the Announcement

Last site update:
2017-12-13 22:10:50

Edit CIB

You can use the following shell script to edit the cib.xml file while heartbeat is running. It will verify the file afterwards and give an option to edit it again when verify fails.

cibvi.sh

#!/bin/sh
#
# cibvi.sh - cib.xml editor
#
# April 5, 2007 Vincent van Gelder - vincent@dauphin-mm.nl
#

CIBADMIN="/usr/sbin/cibadmin"
EDITOR=${EDITOR:-"/usr/bin/vim"}
CRMVERIFY=/usr/sbin/crm_verify

case "$1" in 
        'resources'|'constraints'|'nodes'|'crm_config'|'status' )
                SECTION=$1
        ;;
        *)
                echo "Unknown section"
                echo "Valid values are: nodes, resources, constraints, crm_config, status"
                exit 1
        ;;
esac

TMPFILE=`mktemp -t cib_$SECTION.XXXXXXXXXX` || exit 1


function cleanup {
        rm -f $TMPFILE
}

function get_cib {
        echo "Get cib..."
        $CIBADMIN -o $SECTION -Q > $TMPFILE
#       $CIBADMIN -o $SECTION -Q > cib_$SECTION.previous.xml
}

function cib_edit {
        $EDITOR $TMPFILE
        echo "Verify..."
        $CRMVERIFY -x $TMPFILE 2>&1 | grep ERROR && cib_fail
        echo "Write cib"
        $CIBADMIN -o $SECTION -R -x $TMPFILE
        echo "Done."
        cleanup
        exit
}

function cib_fail {
        echo "Verify failed..."
        read -p "[e]dit, [c]ontinu: " ans
        case "$ans" in
                e|E) cib_edit;;
                c|C) cleanup;
                         exit;;
                *) cib_fail;;
        esac
}

get_cib
cib_edit