Topics

ipupdate script


Ramon Gandia
 

In the ~/scripts/ipupdate script there is a troublesome line:

NEWIPADDRESS=`${WGET} -q --timeout=2 -O- http://checkip.dyndns.org:8245 2>/dev/null \
| cut -d":" -f2 | cut -d" " -f2 | cut -d"<" -f1`

The problem is the --timeout=2 instance. With only 2 seconds grace period, the log gets
full of all sort of error messages. I changed it to 10 seconds, and that took care of it.

But of course, the script will soon be overwritten ... any way to gracefully get around this?

Ramon AL7X 3288 3289 7254


Tony
 

On 6/6/20 8:44 PM, Ramon Gandia wrote:
In the ~/scripts/ipupdate script there is a troublesome line:

NEWIPADDRESS=`${WGET} -q --timeout=2 -O- http://checkip.dyndns.org:8245 2>/dev/null \
| cut -d":" -f2 | cut -d" " -f2 | cut -d"<" -f1`

The problem is the --timeout=2 instance. With only 2 seconds grace period, the log gets
full of all sort of error messages. I changed it to 10 seconds, and that took care of it.

But of course, the script will soon be overwritten ... any way to gracefully get around this?
One would certainly want to make a note of it in the system logbook in case the file needs to be edited in the future, but changing the file's attributes to "immutable" would certainly accomplish the task. First examine the existing attributes, make the change and then verify:

$ lsattr ~/scripts/ipupdate
--------------e---- ~/scripts/ipupdate
$ chattr +i ~/scripts/ipupdate
$ lsattr ~/scripts/ipupdate
----i---------e---- ~/scripts/ipupdate


Ramon Gandia
 

In answer to my own question, I have had a brilliant idea. Like this.
I run a script that takes the ipupdate file, changes "timeout=2" to
"timeout=10", and writes it back.

I can run this script on cron, everytime the update runs. It is
harmless if it is already at "10".

Like this:
$ cat ipupdate | sed 's/timeout=2/timeout=10/g' > temp
$ mv temp ipupdate

On 6/7/20 10:35 AM, Tony via groups.io wrote:
On 6/6/20 8:44 PM, Ramon Gandia wrote:
In the ~/scripts/ipupdate script there is a troublesome line:

NEWIPADDRESS=`${WGET} -q --timeout=2 -O-
http://checkip.dyndns.org:8245 2>/dev/null \
  | cut -d":" -f2 | cut -d" " -f2 | cut -d"<" -f1`

The problem is the --timeout=2 instance.  With only 2 seconds grace
period, the log gets
full of all sort of error messages.  I changed it to 10 seconds, and
that took care of it.

But of course, the script will soon be overwritten ...  any way to
gracefully get around this?
One would certainly want to make a note of it in the system logbook in
case the file needs to be edited in the future, but changing the file's
attributes to "immutable" would certainly accomplish the task. First
examine the existing attributes, make the change and then verify:

$ lsattr ~/scripts/ipupdate
--------------e---- ~/scripts/ipupdate
$ chattr +i ~/scripts/ipupdate
$ lsattr ~/scripts/ipupdate
----i---------e---- ~/scripts/ipupdate




David McAnally
 

That command should rarely take more than 2 seconds. I suggest checking your DNS or network performance. Use a fast DNS resolver, such as google (8.8.8.8) or quad9 (9.9.9.9). See /etc/resolv.conf

David M.
WD5M

On Sat, Jun 6, 2020 at 10:44 PM Ramon Gandia <rfg8yg@...> wrote:
In the ~/scripts/ipupdate script there is a troublesome line:

NEWIPADDRESS=`${WGET} -q --timeout=2 -O- http://checkip.dyndns.org:8245 2>/dev/null \
 | cut -d":" -f2 | cut -d" " -f2 | cut -d"<" -f1`

The problem is the --timeout=2 instance.  With only 2 seconds grace period, the log gets
full of all sort of error messages.  I changed it to 10 seconds, and that took care of it.

But of course, the script will soon be overwritten ...  any way to gracefully get around this?

Ramon AL7X 3288 3289 7254



Fred
 

To add to what David McAnally said once you set your DNS in /etc/resolv.conf run this command  chattr +i  /etc/resolv.conf    This will lock the /etc/resolv.conf  file down so the dns doesn’t change on you. 

On Jun 7, 2020, at 1:55 PM, David McAnally <David.McAnally@...> wrote:


That command should rarely take more than 2 seconds. I suggest checking your DNS or network performance. Use a fast DNS resolver, such as google (8.8.8.8) or quad9 (9.9.9.9). See /etc/resolv.conf

David M.
WD5M

On Sat, Jun 6, 2020 at 10:44 PM Ramon Gandia <rfg8yg@...> wrote:
In the ~/scripts/ipupdate script there is a troublesome line:

NEWIPADDRESS=`${WGET} -q --timeout=2 -O- http://checkip.dyndns.org:8245 2>/dev/null \
 | cut -d":" -f2 | cut -d" " -f2 | cut -d"<" -f1`

The problem is the --timeout=2 instance.  With only 2 seconds grace period, the log gets
full of all sort of error messages.  I changed it to 10 seconds, and that took care of it.

But of course, the script will soon be overwritten ...  any way to gracefully get around this?

Ramon AL7X 3288 3289 7254



k9dc
 

The supported way to do this is to create the directory structure inside /home/irlp/ noupdate/scripts/ and then place the modified file you want inside noupdate/scripts/

As user repeater:
mkdir noupdate
mkdir noupdate/scripts

Basically when the update script runs, one of last things it does, is check for files in noupdate/scripts/ and copies it back to the regular scripts directory.

But as WD5M offered, this should never happen unless something is very wrong with your network. 2 seconds to look up an IP, is an eternity.

There is also the use of the force flag which forces a full authenticated update of your IP. ipupdate by itself only updates if it detects a change of your IP address. It can sometimes fail.

ipupdate force

-k9dc

On Jun 6, 2020, at 23:44, Ramon Gandia <rfg8yg@...> wrote:

In the ~/scripts/ipupdate script there is a troublesome line:

NEWIPADDRESS=`${WGET} -q --timeout=2 -O- http://checkip.dyndns.org:8245 2>/dev/null \
| cut -d":" -f2 | cut -d" " -f2 | cut -d"<" -f1`

The problem is the --timeout=2 instance. With only 2 seconds grace period, the log gets
full of all sort of error messages. I changed it to 10 seconds, and that took care of it.

But of course, the script will soon be overwritten ... any way to gracefully get around this?

Ramon AL7X 3288 3289 7254


k9dc
 

A better way is to edit /etc/dhcp/dhclient.conf and turn off the request domain-name-servers. DHCP must be told what to request, the default is to request nearly everything, but it doesn’t have to.

'man dhclient.conf’ for more information.

-k9dc

On Jun 7, 2020, at 15:16, Fred via groups.io <w5mgm=aol.com@groups.io> wrote:

To add to what David McAnally said once you set your DNS in /etc/resolv.conf run this command chattr +i /etc/resolv.conf This will lock the /etc/resolv.conf file down so the dns doesn’t change on you.


Nosey Nick VA3NNW
 

That command should rarely take more than 2 seconds
I'll be honest, I'm slightly surprised someone has a network that CAN'T
get an answer out of dyndns.org in 2sec but CAN operate IRLP with
acceptable lag/jitter. I struggle to make the curl take longer than 0.4
seconds, and that's on the tiniest pi I had, with all DNS caches flushed
in advance. I'm curious what ISP?... so I can avoid them  ;-)

$ cat ipupdate | sed 's/timeout=2/timeout=10/g' > temp
$ mv temp ipupdate
Simpler, use sed's "in-place" mode, and no need for "/g" if there's only
going to be max 1 per line:

sed -i~ 's/timeout=2/timeout=10/' ipupdate

... yeah or the better supported noupdate/scripts approach

Nick VA3NNW

--
"Nosey" Nick Waterman, VA3NNW/G7RZQ, K2 #5209.
use Std::Disclaimer; sig@...
You sound reasonable...Time to up my medication.