diff --git a/tools/Makefile.am b/tools/Makefile.am index 851e303943..8fdc4df446 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,148 +1,148 @@ # # Copyright (C) 2004-2009 Andrew Beekhof # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # MAINTAINERCLEANFILES = Makefile.in INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl COMMONLIBS = \ $(top_builddir)/lib/common/libcrmcommon.la \ $(top_builddir)/lib/cib/libcib.la \ $(CURSESLIBS) $(CLUSTERLIBS) headerdir = $(pkgincludedir)/crm header_HEADERS = attrd.h pcmkdir = $(datadir)/$(PACKAGE) pcmk_DATA = report.common report.collector sbin_SCRIPTS = crm_report crm_standby crm_master crm_failcount EXTRA_DIST = $(sbin_SCRIPTS) halibdir = $(CRM_DAEMON_DIR) halib_SCRIPTS = hb2openais.sh halib_PROGRAMS = attrd halib_PYTHON = crm_primitive.py hb2openais-helper.py sbin_PROGRAMS = crm_simulate crmadmin cibadmin crm_node crm_attribute crm_resource crm_verify \ crm_uuid crm_shadow attrd_updater crm_diff crm_mon iso8601 testdir = $(datadir)/$(PACKAGE)/tests/cli test_SCRIPTS = regression.sh test_DATA = regression.exp cli.supp if BUILD_SERVICELOG sbin_PROGRAMS += notifyServicelogEvent endif if BUILD_OPENIPMI_SERVICELOG sbin_PROGRAMS += ipmiservicelogd endif if BUILD_HELP man8_MANS = $(sbin_PROGRAMS:%=%.8) crm_report.8 crm_failcount.8 crm_master.8 crm_standby.8 endif ## SOURCES noinst_HEADERS = crmadmin_SOURCES = crmadmin.c crmadmin_LDADD = $(COMMONLIBS) $(CLUSTERLIBS) \ $(top_builddir)/lib/pengine/libpe_status.la crm_uuid_SOURCES = crm_uuid.c crm_uuid_LDADD = $(top_builddir)/lib/common/libcrmcluster.la cibadmin_SOURCES = cibadmin.c cibadmin_LDADD = $(COMMONLIBS) crm_shadow_SOURCES = cib_shadow.c crm_shadow_LDADD = $(COMMONLIBS) crm_node_SOURCES = ccm_epoche.c crm_node_LDADD = $(COMMONLIBS) $(CLUSTERLIBS) \ $(top_builddir)/lib/common/libcrmcluster.la crm_simulate_SOURCES = crm_inject.c crm_simulate_CFLAGS = -I$(top_srcdir)/pengine crm_simulate_LDADD = $(COMMONLIBS) \ $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/pengine/libpengine.la \ $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/transition/libtransitioner.la crm_diff_SOURCES = xml_diff.c crm_diff_LDADD = $(COMMONLIBS) crm_mon_SOURCES = crm_mon.c crm_mon_LDADD = $(COMMONLIBS) $(SNMPLIBS) $(ESMTPLIBS) -llrm \ $(top_builddir)/lib/pengine/libpe_status.la # Arguments could be made that this should live in crm/pengine crm_verify_SOURCES = crm_verify.c crm_verify_LDADD = $(COMMONLIBS) \ $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/pengine/libpengine.la crm_attribute_SOURCES = crm_attribute.c crm_attribute_LDADD = $(COMMONLIBS) crm_resource_SOURCES = crm_resource.c crm_resource_LDADD = $(COMMONLIBS) \ $(top_builddir)/lib/pengine/libpe_rules.la \ $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/pengine/libpengine.la iso8601_SOURCES = test.iso8601.c iso8601_LDADD = $(COMMONLIBS) attrd_SOURCES = attrd.c attrd_LDADD = $(COMMONLIBS) $(top_builddir)/lib/common/libcrmcluster.la #pingd_SOURCES = pingd.c #pingd_LDADD = $(COMMONLIBS) attrd_updater_SOURCES = attrd_updater.c attrd_updater_LDADD = $(COMMONLIBS) if BUILD_SERVICELOG notifyServicelogEvent_SOURCES = notifyServicelogEvent.c notifyServicelogEvent_CFLAGS = `pkg-config --cflags servicelog-1` notifyServicelogEvent_LDFLAGS = `pkg-config --libs servicelog-1` $(top_builddir)/lib/common/libcrmcommon.la endif if BUILD_OPENIPMI_SERVICELOG ipmiservicelogd_SOURCES = ipmiservicelogd.c ipmiservicelogd_CFLAGS = `pkg-config --cflags OpenIPMI OpenIPMIposix servicelog-1` ipmiservicelogd_LDFLAGS = `pkg-config --libs OpenIPMI OpenIPMIposix servicelog-1` $(top_builddir)/lib/common/libcrmcommon.la endif -%.8: % +%.8: % crm_attribute echo Creating $@ chmod a+x $(top_builddir)/tools/$< PATH=$$PATH:$(top_builddir)/tools help2man --output $@ --no-info --section 8 --name "Part of the Pacemaker cluster resource manager" $(top_builddir)/tools/$< clean-generic: rm -f *.log *.debug *.xml *~ install-exec-local: uninstall-local: .PHONY: install-exec-hook diff --git a/tools/crm_failcount b/tools/crm_failcount index d3b97fb91d..a8e4aad5c2 100755 --- a/tools/crm_failcount +++ b/tools/crm_failcount @@ -1,58 +1,51 @@ #!/bin/bash options="" target=`uname -n` TEMP=`getopt -o DGQVN:U:v:i:l:r: --long help,version,resource-id:,node:,uname:,attr-value:,delete-attr,get-value,attr-id:,lifetime:,quiet \ -n 'crm_failcount' -- "$@"` if [ $? != 0 ] ; then echo "crm_failcount - A convenience wrapper for crm_attribute"; echo ""; crm_attribute -?; exit 1 ; fi # Note the quotes around `$TEMP': they are essential! eval set -- "$TEMP" while true ; do case "$1" in -N|--node) target="$2"; shift; shift;; -U|--uname) target="$2"; shift; shift;; -v|--attr-value|-i|--attr-id) options="$options $1 $2"; shift; shift;; -Q|--quiet|-D|--delete-attr|-G|--get-value|-V) options="$options $1"; shift;; -r|--resource-id) options="$options -n fail-count-$2"; shift; shift;; - --version) - if [ -e `dirname $0`/crm_attribute ]; then - `dirname $0`/crm_attribute --version; - else - crm_attribute --version; exit 0 - fi - exit 0 - ;; + --version) crm_attribute --version; exit 0;; --help) echo "crm_failcount - A convenience wrapper for crm_attribute"; echo "Set, update or remove the failcount for the specified resource on the named node"; echo ""; echo "Usage: crm_failcount -r resource_name command [options]"; echo "Options:" echo " --help This text" echo " --version Version information" echo " -V, --verbose Increase debug output" echo " -q, --quiet Print only the value on stdout" echo "" echo " -r, --resource-id=value The resource to update." echo "" echo "Commands:" echo " -G, --query Query the current value of the attribute/option" echo " -v, --update=value Update the value of the attribute/option" echo " -D, --delete Delete the attribute/option" echo "" echo "Additional Options:" echo " -N, --node=value Set an attribute for the named node (instead of the current one)." echo " -l, --lifetime=value Until when should the setting take affect." echo " Valid values: reboot, forever" echo " -i, --id=value (Advanced) The ID used to identify the attribute" exit 0;; --) shift ; break ;; *) echo "Unknown option: $1. See --help for details." exit 1;; esac done crm_attribute -N $target $options -t status -d 0 diff --git a/tools/crm_master b/tools/crm_master index 71631f82da..f1afa6fb9a 100755 --- a/tools/crm_master +++ b/tools/crm_master @@ -1,60 +1,53 @@ #!/bin/bash TEMP=`getopt -o qDGQVN:U:v:i:l:r: --long version,help,resource:,node:,uname:,attr-value:,id:,update:,delete-attr,get-value,attr-id:,lifetime:,quiet \ -n 'crm_master' -- "$@"` if [ $? != 0 ] ; then echo "crm_master - A convenience wrapper for crm_attribute"; echo ""; crm_attribute -?; exit 1 ; fi # Note the quotes around `$TEMP': they are essential! eval set -- "$TEMP" while true ; do case "$1" in -N|--node|-U|--uname|-v|--attr-value|--update|-i|--id|--attr-id|-l|--lifetime) options="$options $1 $2"; shift; shift;; -Q|-q|--quiet|-D|--delete-attr|-G|--get-value|-V) options="$options $1"; shift;; -r|--resource) OCF_RESOURCE_INSTANCE=$2; shift; shift;; - --version) - if [ -e `dirname $0`/crm_attribute ]; then - `dirname $0`/crm_attribute --version; - else - crm_attribute --version; exit 0 - fi - exit 0 - ;; + --version) crm_attribute --version; exit 0;; --help) echo "crm_master - A convenience wrapper for crm_attribute"; echo ""; echo ""; echo "Set, update or delete a resource's promotion score"; echo "This program should normally only be invoked from inside an OCF resource agent" echo ""; echo "Usage: crm_master command [options]"; echo "Options:" echo " --help This text" echo " --version Version information" echo " -V, --verbose Increase debug output" echo " -q, --quiet Print only the value on stdout" echo "" echo "Commands:" echo " -G, --query Query the current value of the attribute/option" echo " -v, --update=value Update the value of the attribute/option" echo " -D, --delete Delete the attribute/option" echo "" echo "Additional Options:" echo " -N, --node=value Set an attribute for the named node (instead of the current one)." echo " -l, --lifetime=value Until when should the setting take affect." echo " Valid values: reboot, forever" echo " -i, --id=value (Advanced) The ID used to identify the attribute" exit 0;; --) shift ; break ;; *) echo "Unknown option: $1. See --help for details." exit 1;; esac done if [ -z "$OCF_RESOURCE_INSTANCE" ]; then echo "This program should normally only be invoked from inside an OCF resource agent" echo "To set the prmotion/master score from the command line, please specify a resource ID with -r" exit 1 fi crm_attribute -N `uname -n` -n master-$OCF_RESOURCE_INSTANCE $options diff --git a/tools/crm_standby b/tools/crm_standby index afdcd37877..352ae2f49d 100755 --- a/tools/crm_standby +++ b/tools/crm_standby @@ -1,90 +1,83 @@ #!/bin/bash op="" options="" lifetime=0 target=`uname -n` TEMP=`getopt -o qDGQVN:U:v:i:l: --long version,help,node:,uname:,id:,attr-value:,delete-attr,get-value,attr-id:,lifetime:,quiet \ -n 'crm_standby' -- "$@"` if [ $? != 0 ] ; then echo "crm_standby - A convenience wrapper for crm_attribute"; echo ""; crm_attribute -?; exit 1 ; fi # Note the quotes around `$TEMP': they are essential! eval set -- "$TEMP" while true ; do case "$1" in -N|--node) target="$2"; shift; shift;; -U|--uname) target="$2"; shift; shift;; -v|--attr-value) options="$options $1 $2"; op=u; shift; shift;; -D|--delete-attr) options="$options $1"; op=d; shift;; -G|--get-value) options="$options $1"; op=g; shift;; -l|--lifetime) options="$options $1 $2"; lifetime=1; shift; shift;; -i|--id|--attr-id) options="$options $1 $2"; shift; shift;; -Q|-q|--quiet|-V) options="$options $1"; shift;; - --version) - if [ -e `dirname $0`/crm_attribute ]; then - `dirname $0`/crm_attribute --version; - else - crm_attribute --version; exit 0 - fi - exit 0 - ;; + --version) crm_attribute --version; exit 0;; --help) echo "crm_standby - A convenience wrapper for crm_attribute"; echo ""; echo ""; echo "Put the name node into and out of standby. Nodes in standby mode may not host cluster resources"; echo ""; echo "Usage: crm_standby crm_standby command [options]"; echo "Options:" echo " --help This text" echo " --version Version information" echo " -V, --verbose Increase debug output" echo " -q, --quiet Print only the value on stdout" echo "" echo "Commands:" echo " -G, --query Query the current value of the attribute/option" echo " -v, --update=value Update the value of the attribute/option" echo " -D, --delete Delete the attribute/option" echo "" echo "Additional Options:" echo " -N, --node=value Set an attribute for the named node (instead of the current one)." echo " -l, --lifetime=value Until when should the setting take affect." echo " Valid values: reboot, forever" echo " -i, --id=value (Advanced) The ID used to identify the attribute" exit 0;; --) shift ; break ;; *) echo "Unknown option: $1. See --help for details." exit 1;; esac done options="-N $target -n standby $options" if [ x$op = x ]; then options="$options -G"; op=g fi if [ $lifetime = 0 ]; then case $op in g) crm_attribute $options -l forever 2>&1 > /dev/null if [ $? = 0 ]; then options="$options -l forever" else options="$options -l reboot -d off" fi ;; u) options="$options -l forever" ;; d) crm_attribute $options -l forever crm_attribute $options -l reboot exit 0 ;; esac fi #echo crm_attribute $options crm_attribute $options