#!/bin/sh
# /etc/dhcp/dhclient-exit-hooks.d/ddclient - exit hook for dhclient

# Run inside subshell so we can use exit to bail.
(
  [ -x /usr/bin/ddclient ] || exit 0
  [ -f /etc/default/ddclient ] || exit 0
  . /etc/default/ddclient
  [ "$run_dhclient" = "true" ] || exit 0

  case $reason in
    BOUND|RENEW|REBIND)
      /usr/bin/logger -t dhclient "$reason, updating IP address with ddclient"
      /usr/bin/ddclient -daemon=0 -syslog > /dev/null 2>&1
      ;;
    *)
      ;;
  esac
)
