0

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.

Raul Chiarella
  • 153
  • 1
  • 10

1 Answers1

0

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.

Raul Chiarella
  • 153
  • 1
  • 10