#!/bin/sh Action=GENERATE SipDomain="" HostMax=0 ExitStatus=0 showUsage() { cat < [/]... Output DNS records in BIND format for sipX services. The output is printed on the standard output; it can be captured in a file and editted into the zone file for your domain. sip-domain Is the domain that will be used as the domain part of your SIP addresses. Typically, this will be your top level domain name (example.com). server-name This is the fully qualified name of a sipX server in your domain (sipx.example.com). May also include the IP address (sipx.example.com/10.1.1.10). If the address is given, then the A record for the host name will be generated; if not, then you must supply that record. The PTR records for reverse (address to name) lookups are not generated. They are nice to have for system management, but sipX does not need them. USAGE } validateFullName() { case ${1} in *.*) echo ${1} break ;; *.) echo ${1} | sed 's/.$//' break ;; *) echo "'${1}' is not a fully qualified name." 1>&2 showUsage exit 1 ;; esac } while [ $# -ne 0 ] do case ${1} in -h|-\?|--help) showUsage exit 0 ;; ## ## handle the 'end of options' marker ## --) ;; ## ## handle an unknown switch ## -*) echo "Unrecognized option '${1}'" 1>&2 showUsage exit 1 ;; *) if [ -z "${SipDomain}" ] then SipDomain=`validateFullName ${1}` else ClusterHosts[${HostMax}]=${1} HostMax=$(($HostMax + 1)) fi ;; esac shift # always consume 1 done HostMax=$(($HostMax - 1)) if [ $HostMax -eq -1 ] then echo "Must specify servers" 1>&2 showUsage exit 1 fi for host in `seq 0 $HostMax` do thishost=${ClusterHosts[$host]} case $thishost in */*) hostname=`echo $thishost | cut -d / -f 1` Host[$host]=`validateFullName $hostname` Addr[$host]=`echo $thishost | cut -d / -f 2` ;; *) Host[$host]=`validateFullName $thishost` Addr[$host]="" ;; esac done cat <