#!/bin/sh # a script to test the basic setup of a CTDB/Samba install # tridge@samba.org September 2007 PATH="$PATH:/sbin:/usr/sbin:/usr/lpp/mmfs/bin" # list of config files that must exist and that we check are the same # on all nodes CONFIG_FILES_MUST="/etc/krb5.conf /etc/hosts /etc/ctdb/nodes /etc/sysconfig/ctdb /etc/resolv.conf /etc/nsswitch.conf /etc/sysctl.conf /etc/samba/smb.conf /etc/fstab /etc/multipath.conf /etc/pam.d/system-auth /etc/sysconfig/nfs /etc/exports /etc/vsftpd/vsftpd.conf" # list of config files that may exist and should be checked that they # are the same on all nodes CONFIG_FILES_MAY="/etc/ctdb/public_addresses /etc/ctdb/static-routes" 2>&1 cat <> $ERRORS } show_file() { fname="$1" echo " ================================" echo " File: $fname" echo " `ls -l $fname 2>&1`" cat "$fname" 2>&1 | sed 's/^/ /' echo " ================================" } show_all() { echo "running $1 on all nodes" onnode all "hostname; date; $1 2>&1 | sed 's/^/ /'" } ERRORS="/tmp/diag_err.$$" NUM_NODES=`wc -l < /etc/ctdb/nodes` MAX_NODE=`expr $NUM_NODES - 1` NUM_ERRORS=0 cat < $tmpf 2>&1 cmp $f $tmpf 2>&1 || { error "File $f is different on node $i" diff -u $f $tmpf } rm -f $tmpf done done for f in $CONFIG_FILES_MAY; do [ -r "$f" ] || { echo "Optional file $f is not present on local node" continue; } show_file $f for i in `seq 0 $MAX_NODE`; do echo "Testing for same config file $f on node $i" tmpf=/tmp/`basename $f`.node$i onnode $i cat $f > $tmpf 2>&1 cmp $f $tmpf 2>&1 || { error "File $f is different on node $i" diff -u $f $tmpf } rm -f $tmpf done done cat < /dev/null` show_all id "$WORKGROUP/Administrator" show_all "wbinfo -p" show_all "wbinfo --online-status" show_all "smbd -b" date echo "Diagnostics finished with $NUM_ERRORS errors" [ -r $ERRORS ] && { cat $ERRORS rm -f $ERRORS } exit $NUM_ERRORS