I am looking for a clever way to do the new serial number. Date will do the first bit no problem (date +%Y%m%d), but I'd love to find a clever way to auto increment the last 2 digits unless it's a new day. Then I could use the same script every time.
/puts on thinking cap. -----Original Message----- From: bind-users-boun...@lists.isc.org [mailto:bind-users-boun...@lists.isc.org] On Behalf Of Jeff Lightner Sent: Tuesday, March 24, 2009 4:54 PM To: Alan Clegg; bind-users@lists.isc.org Subject: RE: Make changes en mass [done] Good point. The serial number should be updated since the zone file is being updated. The sed command could be used to do that as well. for zonefile in `ls *.com` do sed -e s/604800/709600/ -e s/200[0-9][0-1][0-9][0-9][0-9][0-9][0-9]/2009032401/ $zonefile >${zonefile}.new mv $zonefile ${zonefile}.old mv ${zonefile}.new $zonefile done The above does the same expiration value replacement as earlier and also changes the serial number to current day (2009032401 as of this writing). This substitution is based on the preferred serial number syntax of: CCYYMMDDsq where sq is a sequence number (01 being first). It assumes all the zone files have a current serial number using that in the current decade (2000s) and no sequence number higher than 99. The pattern would have to be adjusted if those assumptions weren't valid. -----Original Message----- From: bind-users-boun...@lists.isc.org [mailto:bind-users-boun...@lists.isc.org] On Behalf Of Alan Clegg Sent: Tuesday, March 24, 2009 4:31 PM To: bind-users@lists.isc.org Subject: Re: Make changes en mass [done] John D. Vo wrote: > Thanks Jeff. I prefer your way better, more eloquent than the brute > force method I did. To this point, nobody has updated the serial. AlanC Please consider our environment before printing this e-mail or attachments. ---------------------------------- CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential information and is for the sole use of the intended recipient(s). If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you. ---------------------------------- _______________________________________________ bind-users mailing list bind-users@lists.isc.org https://lists.isc.org/mailman/listinfo/bind-users --------------------------------------------------------------------- This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful. _______________________________________________ bind-users mailing list bind-users@lists.isc.org https://lists.isc.org/mailman/listinfo/bind-users