On 5/4/11 10:22 AM, hugo hugoo wrote: > > So..no way to check that a zone is expired? Hello Hugo,
I recently wrote a small script which mails me about any zones that is due to expire within the next 24 hours. This works by using the last change time of the file on disk and the SOA expiry time. It is a bit hackish but produces a report telling you when a zone will expire, including zones that will expire in the past. If anyone has any improvements on this i would welcome comments ====================================================================== #!/bin/sh ZONEDIR=/var/named/zones/ EMAIL=em...@example.com TOMORROW=$(/bin/date --date="tomorrow" +%s) cd ${ZONEDIR} for zone in $(/bin/ls -1 | /bin/grep -v \.jnl$); do zone_lastupdated=$(/usr/bin/stat -c %Z ${zone}); expiry=$(/usr/bin/dig +short SOA ${zone} @localhost 2>/dev/null| /usr/bin/awk '{print $6}') ; zone_expires=$((zone_lastupdated + expiry)); if [ ${zone_expires} -le ${TOMORROW} ]; then echo ${zone} Expires on $(/bin/date --date "$[$(/bin/date +%s)-${zone_expires}] seconds ago"); fi done | /bin/mail -s "Zones which expire in the next 24 hours" ${EMAIL} ====================================================================== Regards John _______________________________________________ bind-users mailing list bind-users@lists.isc.org https://lists.isc.org/mailman/listinfo/bind-users