1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-01 04:58:35 +03:00

eventscripts: Clean up ctdb_check_command()

* Command is now multiple arguments, preserving quoting
* $service_name no longer printed, no longer an argument
* Debug output from failed command

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 9e25fb261447a196de05937052779b36e75e7215)
This commit is contained in:
Martin Schwenke 2013-04-30 03:54:17 +10:00 committed by Amitay Isaacs
parent 30addb886a
commit 6e2863a4f9
3 changed files with 10 additions and 11 deletions

View File

@ -54,7 +54,7 @@ case "$1" in
;;
monitor)
ctdb_check_command "winbind" "wbinfo -p"
ctdb_check_command wbinfo -p
;;
takeip|releaseip)

View File

@ -570,16 +570,15 @@ ctdb_check_unix_socket() {
######################################################
# check a command returns zero status
# usage: ctdb_check_command SERVICE_NAME <command>
# usage: ctdb_check_command <command>
######################################################
ctdb_check_command() {
service_name="$1"
wait_cmd="$2"
[ -z "$wait_cmd" ] && return;
$wait_cmd > /dev/null 2>&1 || {
echo "ERROR: $service_name - $wait_cmd returned error"
exit 1
}
ctdb_check_command ()
{
_out=$("$@" 2>&1) || {
echo "ERROR: $* returned error"
echo "$_out" | debug
exit 1
}
}
################################################

View File

@ -7,6 +7,6 @@ define_test "winbind down"
setup_winbind
wbinfo_down
required_result 1 "ERROR: winbind - wbinfo -p returned error"
required_result 1 "ERROR: wbinfo -p returned error"
simple_test