
d'une lection et surtout qui kille tous les nmbd rcalcitrants si a ne tourne pas rond. N. darcs-hash:20030130183444-a279a-08fdbd0509215fcbd79108031ac159f741bdfe46.gz
36 lines
1 KiB
Bash
Executable file
36 lines
1 KiB
Bash
Executable file
#!/bin/zsh
|
|
##
|
|
## check-samba
|
|
##
|
|
## Made by stransky
|
|
## Login stransky <stransky@crans.org>
|
|
##
|
|
## Started on jeu 01 oct 2000 19:25:35 CET Jérôme Kieffer
|
|
## Last update jeu 30 jan 2003 19:25:35 CET Nicolas STRANSKY
|
|
##
|
|
# surveillance de nmbd
|
|
|
|
LOG=/var/log/cransMisc/samba-master.log
|
|
|
|
master=$(smbclient -N -L zamok |grep -A5 Master |grep CRANS | awk '{print $2}')
|
|
|
|
if [ "$master" != 'ZAMOK' ];
|
|
then
|
|
# on attend pour être sûr que zamok n'est pas justement en train de déclencher une élection :
|
|
sleep 20
|
|
# on refait le test :
|
|
master=$(smbclient -N -L zamok |grep -A5 Master |grep CRANS | awk '{print $2}')
|
|
# Si on est sûr que ça chie, on sort les armes :
|
|
if [ "$master" != 'ZAMOK' ];
|
|
then
|
|
date=`date`
|
|
echo "$date : Crans local master is $master " >> $LOG
|
|
echo "$date : restarting samba" >> $LOG
|
|
echo -n $date >> $LOG
|
|
/id/samba stop >> $LOG 2>&1
|
|
echo -n $date >> $LOG
|
|
killall -9 nmbd >> $LOG 2>&1 # tant qu'à faire on peut killer complètement nmbd
|
|
echo -n $date >> $LOG
|
|
/id/samba start >> $LOG 2>&1
|
|
fi
|
|
fi
|