Koozali.org: home of the SME Server

Variables Translation in DYNDNS Script

Offline azche24

  • *
  • 163
  • +0/-0
    • http://az-law.de
Variables Translation in DYNDNS Script
« on: May 20, 2004, 06:42:04 PM »
Hi folks,

i am using a german dyndns Provider DNS-Team. The IP get's updated by doing a Lynx call via shell script:

lynx -cookies -source "http://dnsteam.de/dyndnsupdate.php?login=LOGIN-NAME&password=PASSWORD&domain=DOMAIN" -dump

I call this script via a modified dyndns.org script in /etc/sbin/e-smith/dynamic-dns .

So far so good. But if i replace the cleartext variables as stated above by using the $USERID and such variables given by e-smith, i get back errors.

Obviously the $VARIABLES from the config-manager are not translated properly?

grep DynDNS /home/e-smith/configuration shows everything ok.

So what? Why does lynx not recognize the variables?
 :-?
Alexander Ziemann, Berlin - DE

bobk

Variables Translation in DYNDNS Script
« Reply #1 on: May 21, 2004, 12:18:20 AM »
It would help if you post the entire content of your scripts. Just copy and past them between code tags so they look like this
Code: [Select]
sample script

Offline azche24

  • *
  • 163
  • +0/-0
    • http://az-law.de
Variables Translation in DYNDNS Script
« Reply #2 on: May 22, 2004, 01:29:14 PM »
OK, sorry!
Quote from: "bobk"
It would help if you post the entire content of your scripts.


Here she comes  :roll:

#!/bin/sh
# DNS-Update @ DNSTEAM

#------------------------------------------------------------
# Custom dynamic DNS update handler.
#------------------------------------------------------------

IPADDR=$1
USERID=$2
PASSWD=$3
DOMAIN=$4

#------------------------------------------------------------
# Your handler starts here.
#------------------------------------------------------------

#lynx -cookies -source "http://dnsteam.de/dyndnsupdate.php?login=$2&password=$3&domain=$4" -dump
lynx -cookies -source "http://dnsteam.de/dyndnsupdate.php?login=LOGIN&password=PASSWORD&domain=DOMAIN.DE" -dump

#------------------------------------------------------------
# Your handler ends here.
#------------------------------------------------------------

exit 0

This is it.
Alexander Ziemann, Berlin - DE

bobk

Variables Translation in DYNDNS Script
« Reply #3 on: May 23, 2004, 02:33:44 AM »
Try it this way
Code: [Select]
#------------------------------------------------------------
# Custom dynamic DNS update handler.
#------------------------------------------------------------

IPADDR=$1
USERID=$2
PASSWD=$3
DOMAIN=$4

#------------------------------------------------------------
# Your handler starts here.
#------------------------------------------------------------

lynx -cookies -source "http://dnsteam.de/dyndnsupdate.php?login=$USERID&password=$PASSWD&domain=$DOMAIN" -dump

#------------------------------------------------------------
# Your handler ends here.
#------------------------------------------------------------

exit 0

Offline azche24

  • *
  • 163
  • +0/-0
    • http://az-law.de
Variables Translation in DYNDNS Script
« Reply #4 on: May 24, 2004, 08:13:22 AM »
Hi Bob,
Quote from: "bobk"
Try it this way
Code: [Select]

..
lynx -cookies -source "http://dnsteam.de/dyndnsupdate.php?login=$USERID&password=$PASSWD&domain=$DOMAIN" -dump
...


I did that. Provider says: USERDATA notin order...

If i put the same values cleartext into that line, everything is o.k.  :oops:
Alexander Ziemann, Berlin - DE

rickjones

Variables Translation in DYNDNS Script
« Reply #5 on: May 24, 2004, 11:56:44 AM »
Quote from: "azche24"

I did that. Provider says: USERDATA notin order...

If i put the same values cleartext into that line, everything is o.k.  :oops:


All I can say is there must be something wrong in the configuration data. I've written a custom dynamic dns script for ZoneEdit using very similar code and it works fine.

Try dumping parameters to the messages log from within the script using 'logger', e.g.:
logger -t DNS-Team "USER=[$USER] PASSWD=[$PASSWD]"

(The brackets will help you see if there's any rogue white-space).

Offline azche24

  • *
  • 163
  • +0/-0
    • http://az-law.de
Variables Translation in DYNDNS Script
« Reply #6 on: May 26, 2004, 08:43:52 PM »
Quote from: "rickjones"

(The brackets will help you see if there's any rogue white-space).

Space between [] is empty.  :-(
Alexander Ziemann, Berlin - DE

rickjones

Variables Translation in DYNDNS Script
« Reply #7 on: May 26, 2004, 09:34:57 PM »
Quote from: "azche24"

Space between [] is empty.  :-(


I just noticed in your original post you said:
Quote
I call this script via a modified dyndns.org script in /etc/sbin/e-smith/dynamic-dns


Does this mean this code is in a separate script from dyndns.org? If so then I suspect you are not passing the parameters along.

E.g. if your new script is called "dnsteam", then you've modified dyndns.org with something like:

/etc/sbin/e-smith/dynamic-dns/dnsteam

If so you need to write:

/etc/sbin/e-smith/dynamic-dns/dnsteam $@

The "$@" will pass the $1,$2 etc. parameters along to the new script.

Or simpler just replace the file dyndns.org with your new script!

HTH

Anonymous

Variables Translation in DYNDNS Script
« Reply #8 on: May 27, 2004, 04:50:52 PM »
Quote from: "rickjones"


Or simpler just replace the file dyndns.org with your new script!
HTH


I did that. I replaced the original dyndns.org with my improper lines  :-(

rickjones

Variables Translation in DYNDNS Script
« Reply #9 on: May 27, 2004, 10:07:43 PM »
Well I'm stumped! The script is called from /etc/e-smith/events/ip-change/S85update-dns, and that just passes parameters that it reads from the configuration file.

Running '/sbin/e-smith/db configuration show DynDNS' should give something like:
DynDNS=service
    Account=xxx
    Password=xxx
    Service=dyndns.org
    status=enabled

If that's all in place then it's a mystery as to why it doesn't work properly :-( (but at least you've got a work-round)

Sorry, I'm out of ideas...