[Dnsmasq-discuss] Lease Time Detail

clemens fischer ino-news at spotteswoode.dnsalias.org
Tue Oct 11 00:10:30 BST 2011


On Thu-2011/09/22-16:38 richard voigt wrote:

> Surely the DNSMASQ_LEASE_EXPIRES variable should be captured also.

I have this:  in etc/dnsmasq.conf there's

  "dhcp-script=/root/bin/dnsmasq-script-log.sh"

which looks like this:

--- 8< ---
#!/bin/sh
# /root/bin/dnsmasq-script-log.sh _date: 20111011-0110_
# vim: set filetype=sh ts=4:
# -*- mode: sh; -*-

log_file="/log/dhcp-leases.log"
log_pattern="DNSMASQ"
date_fmt="+%y%m%d-%H%M%S"

iam="${0##*/}"

prog_date="/bin/date"
prog_env="/usr/bin/env"
prog_grep="/bin/egrep -i"

cur_date=$(${prog_date} "${date_fmt}")

echo "${iam}: ${cur_date} $*" >> "${log_file}" 2>&1

${prog_env} | ${prog_grep} "${log_pattern}" >> "${log_file}" 2>&1
exit $?
--- 8< ---

and produces output like this:

dnsmasq-script-log.sh: 111011-003747 old 00:22:33:44:55:77 192.168.55.12 wince
DNSMASQ_DOMAIN=juli.eu.org
DNSMASQ_INTERFACE=wlan0
DNSMASQ_TAGS=wlan-2 wlan-2 msft wince wlan0
DNSMASQ_VENDOR_CLASS=Microsoft Windows CE
DNSMASQ_TIME_REMAINING=18000
DNSMASQ_LEASE_EXPIRES=1318304267
DNSMASQ_SUPPLIED_HOSTNAME=wince
DNSMASQ_CLIENT_ID=01:00:22:33:44:55:77


clemens




More information about the Dnsmasq-discuss mailing list