#!/bin/sh # # /etc/dhclient-exit-hooks -- dhclient hook shell script # this file is read from /sbin/dhclient-script, so, you see also that file. # # # dhclient-exit-hooks # logfile=/var/log/dhclient-script.log echo '------- /etc/dhclient-exit-hooks start -------' >> $logfile env >> $logfile if [ x"$new_ip_address"x != x""x ] ; then if [ x"$new_subnet_mask"x != x""x ] ; then echo "interfaces = ${interface} ${new_ip_address}/${new_subnet_mask}" > /usr/local/etc/smb.conf.interfaces echo "interfaces = ${interface} ${new_ip_address}/${new_subnet_mask}" >> $logfile # restart samba server /usr/local/etc/rc.d/samba.sh.sample stop # because it tooks 3 minutes for starting smbd , run background /usr/local/etc/rc.d/samba.sh.sample start > /dev/null & echo "restart samba server." >> $logfile fi fi echo '------- /etc/dhclient-exit-hooks end -------' >> $logfile exit 0 # # end of file #