diff --git a/src/freedombone-ddns b/src/freedombone-ddns index 11ac90aa..454efa2c 100755 --- a/src/freedombone-ddns +++ b/src/freedombone-ddns @@ -47,6 +47,10 @@ function update_inadyn_config { fi if ! grep -q "$DDNS_PROVIDER" /etc/inadyn.conf; then + # remove entry for any previous ddns + sed -i '/^system $/,$d' /etc/inadyn.conf + + # add the new provider { echo ''; echo "system $DDNS_PROVIDER"; echo ' ssl'; @@ -58,6 +62,7 @@ function update_inadyn_config { echo " password $DDNS_PASSWORD" >> /etc/inadyn.conf fi else + # change username/password for an existing provider if [ "$DDNS_USERNAME" ]; then sed -i "s| username .*| username $DDNS_USERNAME|g" /etc/inadyn.conf fi @@ -65,6 +70,7 @@ function update_inadyn_config { sed -i "s| password .*| password $DDNS_PASSWORD|g" /etc/inadyn.conf fi fi + systemctl enable inadyn systemctl restart inadyn }