mirror of
https://github.com/samba-team/samba.git
synced 2025-03-26 18:50:30 +03:00
Eventscripts: remove ctdb_wait_command() and ctdb_wait_tcp_ports() functions.
These haven't been used for a long time. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit f5fd361cadb3ea18d29e2d7215a7853718e48d00)
This commit is contained in:
parent
e3a9991e46
commit
571e55ac0d
@ -87,65 +87,6 @@ nice_service()
|
||||
_service "$@"
|
||||
}
|
||||
|
||||
######################################################
|
||||
# wait for a command to return a zero exit status
|
||||
# usage: ctdb_wait_command SERVICE_NAME <command>
|
||||
######################################################
|
||||
ctdb_wait_command() {
|
||||
service_name="$1"
|
||||
wait_cmd="$2"
|
||||
[ -z "$wait_cmd" ] && return;
|
||||
all_ok=0
|
||||
echo "Waiting for service $service_name to start"
|
||||
while [ $all_ok -eq 0 ]; do
|
||||
$wait_cmd > /dev/null 2>&1 && all_ok=1
|
||||
ctdb status > /dev/null 2>&1 || {
|
||||
echo "ctdb daemon has died. Exiting wait for $service_name"
|
||||
exit 1
|
||||
}
|
||||
[ $all_ok -eq 1 ] || sleep 1
|
||||
done
|
||||
echo "Local service $service_name is up"
|
||||
}
|
||||
|
||||
|
||||
######################################################
|
||||
# wait for a set of tcp ports
|
||||
# usage: ctdb_wait_tcp_ports SERVICE_NAME <ports...>
|
||||
######################################################
|
||||
ctdb_wait_tcp_ports() {
|
||||
service_name="$1"
|
||||
shift
|
||||
wait_ports="$*"
|
||||
[ -z "$wait_ports" ] && return;
|
||||
all_ok=0
|
||||
echo "Waiting for tcp service $service_name to start"
|
||||
while [ $all_ok -eq 0 ]; do
|
||||
all_ok=1
|
||||
for p in $wait_ports; do
|
||||
if [ -x /usr/bin/netcat ]; then
|
||||
/usr/bin/netcat -z 127.0.0.1 $p > /dev/null || all_ok=0
|
||||
elif [ -x /usr/bin/nc ]; then
|
||||
/usr/bin/nc -z 127.0.0.1 $p > /dev/null || all_ok=0
|
||||
elif [ -x /usr/bin/netstat ]; then
|
||||
(netstat -a -n | egrep "0.0.0.0:$p[[:space:]]*LISTEN" > /dev/null) || all_ok=0
|
||||
elif [ -x /bin/netstat ]; then
|
||||
(netstat -a -n | egrep "0.0.0.0:$p[[:space:]]*LISTEN" > /dev/null) || all_ok=0
|
||||
else
|
||||
echo "No tool to check tcp ports availabe. can not check in ctdb_wait_tcp_ports"
|
||||
return 127
|
||||
fi
|
||||
done
|
||||
[ $all_ok -eq 1 ] || sleep 1
|
||||
ctdb status > /dev/null 2>&1 || {
|
||||
echo "ctdb daemon has died. Exiting tcp wait $service_name"
|
||||
return 1
|
||||
}
|
||||
done
|
||||
echo "Local tcp services for $service_name are up"
|
||||
}
|
||||
|
||||
|
||||
######################################################
|
||||
# check that a rpc server is registered with portmap
|
||||
# and responding to requests
|
||||
|
Loading…
x
Reference in New Issue
Block a user