mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +03:00
dfe8de9e4a
For "master", if there is a master then print the PNN, otherwise print nothing. For "list", print the PNN and IP addresses without a colon in between. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
53 lines
781 B
Bash
Executable File
53 lines
781 B
Bash
Executable File
#!/bin/sh
|
|
|
|
prog="ctdb_lvs"
|
|
|
|
# Print a message and exit.
|
|
die ()
|
|
{
|
|
echo "$1" >&2 ; exit ${2:-1}
|
|
}
|
|
|
|
not_implemented_exit_code=1
|
|
|
|
usage ()
|
|
{
|
|
cat >&2 <<EOF
|
|
Usage: $prog { master | list }
|
|
EOF
|
|
exit 1
|
|
}
|
|
|
|
not_implemented ()
|
|
{
|
|
echo "${prog}: command \"$1\" not implemented in stub" >&2
|
|
exit $not_implemented_exit_code
|
|
}
|
|
|
|
ctdb_lvs_master ()
|
|
{
|
|
if [ -n "$FAKE_CTDB_LVS_MASTER" ] ; then
|
|
echo "$FAKE_CTDB_LVS_MASTER"
|
|
return 0
|
|
else
|
|
return 255
|
|
fi
|
|
}
|
|
|
|
ctdb_lvs_list ()
|
|
{
|
|
_pnn=0
|
|
while read _ip _opts ; do
|
|
echo "${_pnn} ${_ip}"
|
|
_pnn=$(($_pnn + 1))
|
|
done <"$CTDB_LVS_NODES"
|
|
}
|
|
|
|
######################################################################
|
|
|
|
case "$1" in
|
|
master) ctdb_lvs_master "$@" ;;
|
|
list) ctdb_lvs_list "$@" ;;
|
|
*) not_implemented "$1" ;;
|
|
esac
|