From: Andrew Tridgell Date: Sun, 17 Jun 2007 02:05:29 +0000 (+1000) Subject: check winbind in monitoring event too X-Git-Tag: tevent-0.9.20~348^2~2486 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9d0a59559440b9b54f5f9855f187eb969898c669;p=thirdparty%2Fsamba.git check winbind in monitoring event too (This used to be ctdb commit bccba656c21d0edbd9840401a3c43a76b1b3bc05) --- diff --git a/ctdb/config/events.d/50.samba b/ctdb/config/events.d/50.samba index df2d8b23cdb..9beac9319aa 100755 --- a/ctdb/config/events.d/50.samba +++ b/ctdb/config/events.d/50.samba @@ -65,6 +65,9 @@ case $cmd in smb_ports=`testparm -sv 2> /dev/null | egrep '\s*smb ports =' | cut -d= -f2` ctdb_check_tcp_ports "Samba" $smb_ports + + # check winbind is OK + ctdb_check_command "winbind" "wbinfo -p" ;; esac diff --git a/ctdb/config/functions b/ctdb/config/functions index ce292bc5fe6..7ca7327ab69 100644 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -162,3 +162,17 @@ ctdb_check_tcp_ports() { } done } + +###################################################### +# check a command returns zero status +# usage: ctdb_check_command SERVICE_NAME +###################################################### +ctdb_check_command() { + service_name="$1" + wait_cmd="$2" + [ -z "$wait_cmd" ] && return; + $wait_cmd > /dev/null 2>&1 || { + echo "`date` ERROR: $service_name - $wait_cmd returned error" + exit 1 + } +}