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

[ -x /usr/sbin/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/sbin/ddclient -daemon=0 -syslog > /dev/null 2>&1
        ;;
    *)
        ;;
esac
