views:

85

answers:

4

Hi, I am using a mac mini with a dynamic ip to store an SVN repository. As an unexpected change of the ip makes it difficult to consistently use the repository, I am interested in creating a cron to log the ip on another server every time it changes. What would be the best way to do this?

+1  A: 

if you want to push the IP address to another server, run ifconfig, parse the results, and write the data to a file on the server (somehow - mount as a nfs share, ftp it, etc).

If you want to detect the changed IP address, assuming the DNS name remains constant, ping the server name and parse the ping results.

Generally, if you have the DNS name constant, use that to access the repository. If you don't - try one from a dynamic dns provider.

gbjbaanb
A: 

Slightly off topic:

Some routers have Dynamic DNS support built in. If it's your router which is getting a new IP and you want internet->lan access via it you can configure it to log it's configuration with the Dynamic DNS provider. In which case you should also configure port forwarding to the correct internal server AND make sure that server's IP does not change dynamically. Many routers have the ability to statically assign a DHCP address to a MAC address for this purpose.

Chris Nava
A: 

I can recommend DNSAlias.com for such a service. On my linux box, a programm called 'ddclient' checks regularly to see what IP address it's hanging off (an ADSL account, by pinging an outside website). If it changed, it would send DnsAlias.com the new info and the *.dnsalias.com (or alternate name) DNS record would be updated within a few minutes. It will update it every 15 days whatever happens, just to be sure, but no more often.

Alister Bulman
+2  A: 

For Subversion usage your approach does not make sense and will not work: Each Workingcopy stores its repository URL inside .svn folder, so if your IP changes you have to relocate your workingcopy via

 `svn switch --relocate`

so it will not safe you any work. YOu really should use a dynamic DNS Service

Peter Parker