Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F4624561
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/tools/crm_standby b/tools/crm_standby
index c1b14b610b..0b30eb6508 100755
--- a/tools/crm_standby
+++ b/tools/crm_standby
@@ -1,90 +1,96 @@
#!/bin/bash
HELPTEXT="crm_standby - convenience wrapper for crm_attribute
Check, enable or disable standby mode for a cluster node.
Nodes in standby mode may not host cluster resources.
Usage: crm_standby <command> [options]
Commands:
--help Display this text and exit
--version Display version information and exit
-G, --query Display the current value of standby mode (on/off)
-v, --update=<value> Update the value of standby mode (on/off)
-D, --delete Let standby mode use default value
Options:
-V, --verbose Increase debug output (may be specified multiple times)
-q, --quiet Print nothing on stdout except the standby status
-N, --node=<value> Operate on the named node instead of the current one
-l, --lifetime=<value> Until when the setting should take effect (reboot/forever)
-i, --id=<value> (Advanced) ID used to identify the XML attribute"
op=""
options=""
lifetime=0
-target=$(crm_node -n)
+target=""
BACKWARD_COMPATIBLE="get-value,attr-value:,delete-attr,uname:,attr-id:"
TEMP=$(getopt -o qDGQVN:U:v:i:l: \
--long help,version,query,update:,delete,verbose,quiet,node:,lifetime:,id:,$BACKWARD_COMPATIBLE \
-n 'crm_standby' -- "$@")
if [ $? -ne 0 ]; then
echo
echo "$HELPTEXT"
exit 1
fi
# The quotes around $TEMP are essential!
eval set -- "$TEMP"
while true ; do
case "$1" in
-N|--node|-U|--uname) target="$2"; shift 2;;
-G|--query|--get-value) options="$options --query"; op=g; shift;;
-v|--update|--attr-value) options="$options --update $2"; op=u; shift 2;;
-D|--delete|--delete-attr) options="$options --delete"; op=d; shift;;
-l|--lifetime) options="$options --lifetime $2"; lifetime=1; shift 2;;
-i|--id|--attr-id) options="$options --id $2"; shift 2;;
-q|-Q|--quiet|-V|--verbose) options="$options $1"; shift;;
--version) crm_attribute --version; exit 0;;
--help) echo "$HELPTEXT"; exit 0;;
--) shift ; break ;;
*) echo "crm_standby: unrecognized option '$1'"; echo; echo "$HELPTEXT"; exit 1;;
esac
done
+# It's important to call cluster commands only after arguments are processed,
+# so --version and --help work without problems even if those commands don't.
+if [ "$target" = "" ]; then
+ target=$(crm_node -n)
+fi
+
options="-N $target -n standby $options"
if [ x$op = x ]; then
options="$options -G"; op=g
fi
# If the user didn't explicitly specify a lifetime ...
if [ $lifetime -eq 0 ]; then
case $op in
g)
# For query, report the forever entry if one exists, otherwise
# report the reboot entry if one exists, otherwise report off.
crm_attribute $options -l forever 2>&1 > /dev/null
if [ $? -eq 0 ]; then
options="$options -l forever"
else
options="$options -l reboot -d off"
fi
;;
u)
# For update, default to updating the forever entry.
options="$options -l forever"
;;
d)
# For delete, default to deleting both forever and reboot entries.
crm_attribute $options -l forever
crm_attribute $options -l reboot
exit 0
;;
esac
fi
crm_attribute $options
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Jul 8, 6:34 PM (2 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2002688
Default Alt Text
(3 KB)
Attached To
Mode
rP Pacemaker
Attached
Detach File
Event Timeline
Log In to Comment