Source
echo "`date +"%d.%m.%Y %H:%M:%S"`: cache file $cache_file don't exists or isn't readable, exiting..." >>"$logfile"
#-----------------------------------------------------------------------
# /var/install/bin/samba-winshook - trigger actions, if wins.dat changed
#
# Copyright (c) 2002-2013 Thomas Bork, tom(at)eisfair(dot)net
#
# Creation : 2006-01-01 tb/jv
#
# With idees from Stephen Rothwell <sfr@linuxcare.com> and
# Rod Smith <rodsmith@rodsbooks.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#-----------------------------------------------------------------------
if [ $# -lt 4 ]
then
{
echo "Usage: $0 op name type ttl [ip_addr ...]"
echo " op is one of add, refresh, delete"
echo " name is the NETBIOS name"
echo " type is the NETBIOS name type"
echo " ttl is the NETBIOS time to live"
echo " ip_addr's are the remaining IP addresses for this name"
} 1>&2
exit 1
fi
op=$1
name=$2
type=$3
wins_ttl=$4
shift 4
ip_addrs="$@"
dns_server_ip='127.0.0.1'
ttl=3600
hostname=`echo $HOSTNAME | tr 'a-z' 'A-Z'`
do_update='no'
logfile='/var/log/log.winshook'
log='no'
delay='60'
# The name of a cache file to use to avoid continual updates
# of the same name and IP addresses. If you comment this out
# then the cache is not kept at all.
cache_file=/var/lock/samba/wins_update.cache
# NETBIOS name types that we want to create DNS records for:
# 20 is server
# 00 is workstation
# 03 is user
useful_types='20 00 03'
if [ "$log" = "yes" ]
then
echo "`date +"%d.%m.%Y %H:%M:%S"`: op is $op, name is $name, type is $type" >>"$logfile"
fi
for i in $useful_types
do
if [ "$type" = "$i" ]
then