Score:0

How to automatically save and force update of a dynamic DNS on pfSense?

ru flag

Everytime the IP address of my pfSense changes i need to manually log-in to the panel, go to Services > Dynamic DNS > Actions [Edit] > ♻ Save & Force Update

Please, how do i do this using Cron ?? I already installed Package 'Cron' and did the following (Based on another question here on ServerFault - It didn't work.)

1 1 * * * root /usr/bin/nice -n20 /etc/rc.force.dyndns.update

Code in rc.force.dyndns.update is:

#!/bin/sh
rm /cf/conf/dyndns\_wancustom\\'\\'0.cache
/etc/rc.dyndns.update

It did not work. The problem keeps happening.

Score:0
ru flag

Ok, after almost 4 months i was able to solve this by using the following code, and leaving it at a cronjob running every 30 minutes.

CRON: */30 * * * * root /usr/bin/nice -n20 /etc/rc.force.dyndns.update

#!/bin/sh
dynamicHost=""
myIP=`dig +short myip.opendns.com @resolver1.opendns.com`
myIP_error=$?
noIP=`dig $dynamicHost | grep -A1 ANSWER | grep IN | cut -f 6`

if [ "$myIP" == "$noIP" ] ; then
    exit
else

    if [ "$myIP_error" -eq 0 ]
        then
            /etc/rc.dyndns.update
        else
            exit
    fi
fi

I did not run into any more problems after doing this.

Score:0
dj flag

Because you must only modify the original command(yours is badly formed)

#!/bin/sh
rm /cf/conf/dyndns\_wancustom\\'\\'0.cache
/etc/rc.dyndns.update

BECOME =>

#!/bin/sh
rm /cf/conf/dyndns\_wancustom\'\'*.cache
/etc/rc.dyndns.update

with this modification, all dyncache will be deleted.

Everything will work fine ;)

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.