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
}
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
+ }
+}