#!/bin/bash
PATH="$PATH:/bin:/usr/bin:/sbin:/usr/sbin"
WINS_SERVER=134.109.102.1
IP=134.109.96.136
if ! (nmblookup -M V54HRZ | grep $IP >/dev/null);
then
logger Master Browser Status verloren. Forcing Election.
echo `nmblookup -M V54HRZ` | mail -s "Samba restarted(not Master)" root
killall nmbd &>/dev/null
killall nmbd &>/dev/null
killall nmbd &>/dev/null
nmbd -D
fi
if ! (nmblookup -R -U $WINS_SERVER "*#1b"|grep $IP|grep "<1b>" &>/dev/null)
then
killall nmbd &>/dev/null
killall nmbd &>/dev/null
killall nmbd &>/dev/null
nmbd -D
echo "Registrierung als DMB am WINS verloren"|mail root -s "Samba restarted (WINS)"
fi
exit 0
|