check winbind in monitoring event too
authorAndrew Tridgell <tridge@samba.org>
Sun, 17 Jun 2007 02:05:29 +0000 (12:05 +1000)
committerAndrew Tridgell <tridge@samba.org>
Sun, 17 Jun 2007 02:05:29 +0000 (12:05 +1000)
config/events.d/50.samba
config/functions

index df2d8b23cdba1e8cb133db9dfe38ac5294aca7c5..9beac9319aa41c5cd88b0d19228f35818136d2b4 100755 (executable)
@@ -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
index ce292bc5fe602d4d01a5255a7abd6d6361e63858..7ca7327ab69cf3e81bb1b2b37091f556a5e65d59 100644 (file)
@@ -162,3 +162,17 @@ ctdb_check_tcp_ports() {
       }
   done
 }
+
+######################################################
+# check a command returns zero status
+# usage: ctdb_check_command SERVICE_NAME <command>
+######################################################
+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
+  }
+}