Koozali.org: home of the SME Server

DynDns - Keeping it up to date

Anonymous

DynDns - Keeping it up to date
« Reply #15 on: May 07, 2004, 10:23:46 PM »
Quote from: "genzil"
PhilV, you can try the folllowing.

Change to a directory of your chosing.
Open a new file. ie vi update.sh
Enter in the following code (change words that start with a % to your values)
Code: [Select]
#!/bin/bash

curr_ip=wget -q -O- http://www.whatismyip.com/ | grep "Your IP is " - | cut -d" " -f4

old_ip=cat ip.tmp

logger -t dyndns.org "Stored IP : $old_ip"
logger -t dyndns.org "Current IP: $curr_ip"

if [ "$old_ip" = "$curr_ip" ]; then
logger -t dyndns.org "Action: no update"
else
logger -t dyndns.org  "Action: update"
/sbin/e-smith/dynamic-dns/dyndns.org $curr_ip %username %password %domain
echo $curr_ip > ip.tmp
logger -t dyndns.org  "Status: updated"
fi



Hmm, had a go at this, but at the point where we are trying to get curr_ip and old_ip, rather than execute the instructions in the single quotes, it seems to just place that text into the variable. i.e.

$old_ip ends up containing:

cat ip.tmp

I can tell this by looking in my /var/log/messages

Any ideas how to fix this?

Thx,

Phil

PhilV

DynDns - Keeping it up to date
« Reply #16 on: May 08, 2004, 12:59:19 AM »
I'm not sure what is happening here!

I have made a test file, with just a few lines in it:
(I have put some basic text into a file called ip.tmp just for testing purposes)

Code: [Select]
#!/bin/sh
#file called mytest
BOB='cat ip.tmp'
$BOB
logger -t dyndns.org "TRIAL: $BOB"


If at the terminal i type:
Code: [Select]
# ./mytest

I get a response at the command line of:

Code: [Select]
This is the contents of the ip.tmp file

But in my /var/log/messages file I get:

Code: [Select]
dyndns.org: TRIAL: cat ip.tmp

Any ideas?

PhilV

DynDns - Keeping it up to date
« Reply #17 on: May 08, 2004, 01:08:56 AM »
ARGHHH!!!

Now I see the problem!

Have to be VERY careful to make sure I use  not '

Oh well, now to try again!

Offline nigeltodd

  • ****
  • 82
  • +0/-0
    • http://nigelt.dyndns.org
DynDNS & DDCLient
« Reply #18 on: May 10, 2004, 02:49:48 PM »
DDClient will also letu use the NIC interface to ur cable or dsl modem. That way if the link fails, it will reset every time! however, I also have a problem getting DDCLient to work properly for a virtual domain. ANy ideas?
smoke-free since June 24th, 2004............