HostLeaseFiles="/var/lib/dhcp/dhclient-${interface}.lease /var/run/dhclient-${interface}.lease /var/lib/dhcp/dhclient-${interface}.leases"
unset new_netbios_name_servers WINSSERVERS NETBIOSSCOPE
for HostInfo in ${HostInfoFiles}; do
if test -r ${HostInfo}; then
break
fi
done
...
if -n "${HostInfo}" -o -n "${HostLease}" ]; then
if test "${HostInfo}" -nt "${HostLease}"; then
source "${HostInfo}"
OLD_IFS=${IFS}
IFS=','
for server in "${WINSSERVERS} ${NETBIOSNAMESERVER}"; do
new_netbios_name_servers="${new_netbios_name_servers} ${server}"
done
IFS=${OLD_IFS}
elif test "${HostLease}" -nt "${HostInfo}"; then
eval $( awk 'BEGIN { FS=":blank:];]*" } /netbios-name-servers/ { netbios_name_servers=$4 }; /netbios-scope/ { netbios_scope=$4 } END { print "new_netbios_name_servers=\"" netbios_name_servers "\"
NETBIOSSCOPE=" netbios_scope}' "${HostLease}")
else
log_err "No dhcpcd info nor dhclient leases file found for ${interface}."
fi
fi
notice how in the first part of code
the HostLeaseFiles reads files in “/var/lib/dhcp/dhclient-${interface}.lease”
this is wrong
$(interface) only returns the name/type of the network (eth0, eth1 or wlan0 and so on)
on the other hand, the real lease file located in /var/lib/dhcp is called “dhclient-A-Bunch-of-Hexa-Code-${interface}.lease”
so, due to wrong file name, hostlease file isnt found and results in the error of “No dhcpcd info nor dhclient leases file found for ${interface}” in /var/log/messages, as script executes
log_err "No dhcpcd info nor dhclient leases file found for ${interface}."
from the second part of the code
hence, in order to fix this
/var/lib/dhcp/dhclient-${interface}.lease
needs to be changed to
/var/lib/dhcp/dhclient-*-${interface}.lease
now, u wont see that annoying error message anymore