L'lection en browse master + local master dure environ 15-20 secondes donc
20 secondes d'attente ce n'tait pas assez. L le script a l'air de bien marcher. N. darcs-hash:20030201100634-a279a-d17c9bb048d5e65352b4037ca818ec18969b579c.gz
This commit is contained in:
parent
2a8da503f1
commit
5092e4b5a6
1 changed files with 10 additions and 8 deletions
18
check-samba
18
check-samba
|
@ -6,7 +6,7 @@
|
|||
## 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
|
||||
## Last update sam 01 fév 2003 00:24:11 CET Nicolas STRANSKY
|
||||
##
|
||||
# surveillance de nmbd
|
||||
|
||||
|
@ -16,21 +16,23 @@ master=$(smbclient -N -L zamok |grep -A5 Master |grep CRANS | awk '{print $2}')
|
|||
|
||||
if [ "$master" != 'ZAMOK' ];
|
||||
then
|
||||
echo "$(date) : Crans local master is \"$master\" ; waiting to confirm" >> $LOG
|
||||
# on attend pour être sûr que zamok n'est pas justement en train de déclencher une élection :
|
||||
sleep 20
|
||||
sleep 30
|
||||
# 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
|
||||
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
|
||||
echo -n "$(date) : " >> $LOG
|
||||
killall -9 nmbd >> $LOG 2>&1 # tant qu'à faire on peut killer complètement nmbd
|
||||
echo -n $date >> $LOG
|
||||
echo -n "$(date) : " >> $LOG
|
||||
/id/samba start >> $LOG 2>&1
|
||||
else
|
||||
echo "$(date) : Well done, good boy" >> $LOG
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue