File: crm_master

package info (click to toggle)
pacemaker 1.0.9.1%2Bhg15626-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 34,668 kB
  • ctags: 5,645
  • sloc: xml: 87,444; ansic: 57,853; python: 11,479; sh: 5,255; makefile: 663; perl: 387; sed: 262
file content (27 lines) | stat: -rwxr-xr-x 1,142 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash

TEMP=`getopt -o DGQVN:U:v:i:l:r: --long resource:,node:,uname:,attr-value:,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|-i|--attr-id|-l|--lifetime) options="$options $1 $2"; shift; shift;;
	    -Q|--quiet|-D|--delete-attr|-G|--get-value|-V) options="$options $1"; shift;;
	    -r|--resource) OCF_RESOURCE_INSTANCE=$2; shift; shift;;
	    --) shift ; break ;;
	    *) echo "crm_master - A convenience wrapper for crm_attribute"; echo ""; echo "Unknown option: $1"; crm_attribute -?; 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