automating zoneedit updates

I don’t guess I need this anymore, since with Speakeasy I am on a static IP address. But in case it’s useful to anyone else . . . .

<makeconf.sh: this derives the current IP address assigned to a given interface and makes a template file.>
#!/bin/sh
cd /usr/home/paul/bin/zoneclient
rm www.tmp
ifconfig xl0 | grep "inet " | awk '{ print $2 }' > www.tmp
head -1 /etc/resolv.conf | awk '{print $2 }' >> www.tmp

www.tmp contains this:
72.1.134.183
paulbeard.org

If I was really clever (and needed it) I could start with the values in rc.conf, since a change to the external network interface — xl0 in my example — could mess things up. A little sed(1) magic would be helpful here.

Once I have learned the IP address assigned to me, I run this:
<zoneclient.sh>
#!/bin/sh
cd /usr/home/paul/bin/zoneclient
./makeconf.sh
./zoneclient.py --optfile ./optfile --acct ./acct

(See zoneclient’s usage message or docs for the contents of those files.)

zoneclient/zoneedit has been trouble-free so far (touch wood), and should work for anyone who has to work with a dynamically assigned address.

[composed and posted with ecto]

Leave a Reply

Your email address will not be published. Required fields are marked *