summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/UNIT/eventscripts/stubs/smnotify
blob: 78710346998860d02501935d59bef162f9f5cedd (plain)
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
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh

usage()
{
	_prog="${0##*/}" # basename
	cat <<EOF
Usage: ${_prog} --client=CLIENT --ip=IP --server=SERVER --stateval=STATEVAL
EOF
	exit 1
}

cip=""
sip=""
mon_name=""
state=""

while [ $# -gt 0 ] ; do
	case "$1" in
	--client) cip="$2" ; shift 2 ;;
	--client=*) cip="${1#*=}" ; shift ;;
	--ip) sip="$2" ; shift 2 ;;
	--ip=*) sip="${1#*=}" ; shift ;;
	--server)  mon_name="$2" ; shift 2 ;;
	--server=*)  mon_name="${1#*=}" ; shift ;;
	--stateval) state="$2" ; shift 2 ;;
	--stateval=*) state="${1#*=}" ; shift ;;
	--) shift ; break ;;
	-*) usage ;;
	*) break ;;
	esac
done
[ $# -eq 0 ] || usage

if [ -z "$cip" -o -z "$sip" -o -z "$mon_name" -o -z "$state" ] ; then
	usage
fi

echo "SM_NOTIFY: ${sip} -> ${cip}, MON_NAME=${mon_name}, STATE=${state}"