generate_ptr.sh 475 B

12345678
  1. #!/bin/sh
  2. cp ${WORKSPACE}/template.168.192.in-addr.arpa.zone ${WORKSPACE}/$1.168.192.in-addr.arpa.zone
  3. grep "192\.168\.$1\.[0-9]\{1,3\}" ${WORKSPACE}/template.infoclinica.lan.zone|awk '{ print $1 " " $4 }' | while read name ip
  4. do
  5. last_octet=$(echo "${ip}"|awk -F"." '{print $4}')
  6. echo -e "${last_octet}\tIN\tPTR\t${name}.infoclinica.lan." >> ${WORKSPACE}/$1.168.192.in-addr.arpa.zone
  7. done
  8. sed -i "s/.*; serial.*/ $2 ; serial/" ${WORKSPACE}/$1.168.192.in-addr.arpa.zone