0

Is there any way to force ddclient to run some script on succcessful update? No-IP client have that feature, but I must use dyndns service.

Thanks in advance.

peca
  • 74
  • 1
  • 7

4 Answers4

2

This page says you can configure a postscript-parameter in ddclient.conf:

postscript=/usr/local/sbin/do-it-after-ddclient-change.sh
jscott
  • 24,204
  • 8
  • 77
  • 99
Borke
  • 21
  • 2
0

@Rolando For Asterisk I needed the (changed) public IP to be active immediately, so that Asterisk can determine it's external IP.

Nice succinct ddclient-post script to update IP to /etc/hosts (I have not tested)

Just that the information I think Asterisk also needs that info in something like: /etc/asterisk/sip_general_custom.conf icesupport=yes stunaddr=stun.l.google.com:19302 srvlookup=yes allowguest=yes ;externip=1.2.3.4 externhost=subdom.dom.tld localnet=192.168.0.0/16 But also Debian Sources has a script (an ascii file) for this sample-etc_dhcpc_dhcpcd-eth0.exe The file has an 'e' atribute that can be removed before edit/nameing with chattr -e sample-etc_dhcpc_dhcpcd-eth0.exe

and after with chattr +e dhcpcd-eth0

apparently the eth0 part is supposed to get changed to match your iface , and of course chmod +x dhcpcd-eth0 to make it ececutable.

ostredge
  • 1
  • 1
0

I haven't used this option, but ddclient does have a postscript option. Per the documentation, ddclient will run the script specified in the postscript option, passing in the new IP. Peeking in the ddclient Perl code, the script is called via system().

rickumali
  • 101
  • 2
0

The IP is given as argument. For Asterisk I needed the (changed) public IP to be active immediately, so that Asterisk can determine it's external IP. I accomplished this by editting the /etc/hosts file with the post script. Replace sip.foo.net with your own.

#!/bin/sh
#
# Update hosts file with changed IP
#
IP=$1

D=sip.foo.net
DOMAIN=`echo "$D" | sed 's/\./\\\\./g'`
sed -i_bak -e "/[\t]$DOMAIN/d" /etc/hosts

echo "$IP\t$D" >>/etc/hosts
rolandow
  • 101