DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2009-07-27 22:11:13

wenzlerpaul
New member
Registered: 2009-07-27
Posts: 2

ZoneEdit and DNS-323

Hi,

DNS-323 as we know is equipped with its own ddns to update certain Dynamic DNS services, however, the panel did not include ZoneEdit.com which is what I was using to update a domain with my dynamic ip address.  Because of this, I created my own little script to make that auto-update for me.

Note:
crontab was not working for me.  I tried everything I could find in this forum and other site on adding a custom cron job through a script (editcron.sh for example) but the system drops my entry after few minutes when i check through crontab -l .  It appears correctly upon reboot and after few minutes it disappears, not sure why.

If you can use crontab for this purpose, you might as well use it because it is a better option.

ZoneEdit is the only service I liked that allows you to add a FQDN (domain name) and update the dynamic ip address painlessly.  I know that there are some other service that does this but this one is for ZoneEdit purpose only.

If you do not have an account with ZoneEdit, you can signup for a free account and follow the tutorial in this link http://www.4webhelp.net/tutorials/misc/zoneedit.php

Note:
On ZoneEdit, you will need to add www.domain.com and domain.com so both will resolve to your box correctly, you can add a temporary ip just to setup your domain/s

Once you have your ZoneEdit account ready and your domain name pointed to ZoneEdit dns, you can do the steps below in your DNS-323/343 box:

cd /mnt/HD_a2/ffp/start
vi zoneeditip.sh

type in or paste the following code without the asterisks:
***************************************************
#!/ffp/bin/sh

wget -qO - 'http://zoneeditusername:zoneeditpass@dynamic.zoneedit.com/auth/dynamic.html?host=www.domain.com,domain.com'


at NOW + 5 minutes < /mnt/HD_a2/ffp/start/zoneeditip.sh
***************************************************

press ESC then type :wq then enter to save and exit

to make it executable:
chmod a+x /mnt/HD_a2/ffp/start/zoneeditip.sh

To start the update:
/mnt/HD_a2/ffp/start/zoneeditip.sh

to check if the "at" has a scheduled job running:
atq

to kill a scheduled job:
cd /var/spool/at
ls
rm jobnumber (where jobnumber looks like this a00087013d90f4)


I used the code above because of my crontab problem.

On ZoneEdit, the suggested wget command was
wget -O - --http-user=username --http-passwd=password 'http://dynamic.zoneedit.com/auth/dynamic.html?host=www.mydomain.com'

However, the wget version of busybox does not have all the options added so this will cause an error of "unknown options"

refer to: http://www.zoneedit.com/doc/dynamic.html
also, the reason why I am updating both host www.domain.com and domain.com is that it somehow fails time to time to update both entries, so I just opted to update both.

You can also adjust the time on your at command, please refer to my other post regarding this matter: http://dns323.kood.org/forum/viewtopic.php?id=4720

Hope this helps,
Paul

Last edited by wenzlerpaul (2009-07-28 01:23:09)

Offline

 

#2 2010-11-03 20:00:35

DarkHorseDre
Member
From: London, UK
Registered: 2008-05-13
Posts: 29

Re: ZoneEdit and DNS-323

wenzlerpaul wrote:

Hi,

DNS-323 as we know is equipped with its own ddns to update certain Dynamic DNS services, however, the panel did not include ZoneEdit.com which is what I was using to update a domain with my dynamic ip address.  Because of this, I created my own little script to make that auto-update for me.

Note:
crontab was not working for me.  I tried everything I could find in this forum and other site on adding a custom cron job through a script (editcron.sh for example) but the system drops my entry after few minutes when i check through crontab -l .  It appears correctly upon reboot and after few minutes it disappears, not sure why.

If you can use crontab for this purpose, you might as well use it because it is a better option.

ZoneEdit is the only service I liked that allows you to add a FQDN (domain name) and update the dynamic ip address painlessly.  I know that there are some other service that does this but this one is for ZoneEdit purpose only.

If you do not have an account with ZoneEdit, you can signup for a free account and follow the tutorial in this link http://www.4webhelp.net/tutorials/misc/zoneedit.php

Note:
On ZoneEdit, you will need to add www.domain.com and domain.com so both will resolve to your box correctly, you can add a temporary ip just to setup your domain/s

Once you have your ZoneEdit account ready and your domain name pointed to ZoneEdit dns, you can do the steps below in your DNS-323/343 box:

cd /mnt/HD_a2/ffp/start
vi zoneeditip.sh

type in or paste the following code without the asterisks:
***************************************************
#!/ffp/bin/sh

wget -qO - 'http://zoneeditusername:zoneeditpass@dynamic.zoneedit.com/auth/dynamic.html?host=www.domain.com,domain.com'


at NOW + 5 minutes < /mnt/HD_a2/ffp/start/zoneeditip.sh
***************************************************

press ESC then type :wq then enter to save and exit

to make it executable:
chmod a+x /mnt/HD_a2/ffp/start/zoneeditip.sh

To start the update:
/mnt/HD_a2/ffp/start/zoneeditip.sh

to check if the "at" has a scheduled job running:
atq

to kill a scheduled job:
cd /var/spool/at
ls
rm jobnumber (where jobnumber looks like this a00087013d90f4)


I used the code above because of my crontab problem.

On ZoneEdit, the suggested wget command was
wget -O - --http-user=username --http-passwd=password 'http://dynamic.zoneedit.com/auth/dynamic.html?host=www.mydomain.com'

However, the wget version of busybox does not have all the options added so this will cause an error of "unknown options"

refer to: http://www.zoneedit.com/doc/dynamic.html
also, the reason why I am updating both host www.domain.com and domain.com is that it somehow fails time to time to update both entries, so I just opted to update both.

You can also adjust the time on your at command, please refer to my other post regarding this matter: http://dns323.kood.org/forum/viewtopic.php?id=4720

Hope this helps,
Paul

Looks good dude!  I use zonedit as I could not find a provider that permits custom domains bought elsewhere to be used for free!
My router has an issue with DDNS, and as you know, the DNS323 restricts updates to certain services.

I have no idea about the crontab issue, but seen similar complaints - I dont have time to investigate, so will use something that works!

One question I have: does the command "at NOW +5 blah.." run the update & then creates a job for 10 minutes?
If so, does it not loop and create many jobs? I guess I'm just not understanding how the command to create a job of itself will self-sustain without issue.  I assume its ok, but just checking!

Cheers


DNS-323 as stock, with ffp.  Version 1.08, WinXp SP2 on Dell PC and HP laptop. GigE on all links & switch. 802.11g wireless :\

Offline

 

#3 2010-11-03 20:03:54

DarkHorseDre
Member
From: London, UK
Registered: 2008-05-13
Posts: 29

Re: ZoneEdit and DNS-323

Oh, another thing: How would I create an ongoing log of the output?  I can use output redirect (">") to do this when I run manually, but I'm wondering how to do this with the AT task?


DNS-323 as stock, with ffp.  Version 1.08, WinXp SP2 on Dell PC and HP laptop. GigE on all links & switch. 802.11g wireless :\

Offline

 

#4 2010-11-03 20:32:07

DarkHorseDre
Member
From: London, UK
Registered: 2008-05-13
Posts: 29

Re: ZoneEdit and DNS-323

ok scratch the last question - I addeed a ">> logfilepath/logfilename" to the end of the zoneedit mget command and it seems to work a treat smile
I'll worry about the file size and i/o overhead if I don't find a better solution within the next few months!


DNS-323 as stock, with ffp.  Version 1.08, WinXp SP2 on Dell PC and HP laptop. GigE on all links & switch. 802.11g wireless :\

Offline

 

#5 2010-11-03 21:28:51

karlrado
Member
Registered: 2009-12-07
Posts: 229

Re: ZoneEdit and DNS-323

DarkHorseDre wrote:

wenzlerpaul wrote:

Hi,

Note:
crontab was not working for me.  I tried everything I could find in this forum and other site on adding a custom cron job through a script (editcron.sh for example) but the system drops my entry after few minutes when i check through crontab -l .  It appears correctly upon reboot and after few minutes it disappears, not sure why.

I have no idea about the crontab issue, but seen similar complaints - I dont have time to investigate, so will use something that works!

The few minute delay seems odd.  Is there something in your fun_plug that is launching something that periodically updates the crontab?

The "similar complaints" are about crontab modifications performed in a fun_plug not showing up at all.  The firmware boot script launches the crontab daemon before it calls the user fun_plug.  The crontab daemon runs in the background and may take seconds to finish loading the default crontab.  If the user fun_plug is also updating the crontab, you have a race condition and so the user modifications may not take effect.  It all depends on who finishes first.

I suppose if your fun_plug is keeping the machine VERY busy and/or you are starting a LOT of services in a "start" directory, then it might be possible for the crontab daemon to take a "few" minutes to overwrite your crontab with its own.  But I don't know for sure.

One way to help avoid this is to put a call to "sleep" in your fun_plug, just before modifying the crontab.  People have been using sleeps of 2-3 minutes or whatever, which is not perceived to be a problem when booting.

A more deterministic way is to wait in the fun_plug until the crontab is loaded.  For example, one could write script code to read the crontab with "crontab -l" and if it is empty, sleep for a second or two and then try again.  When the crontab comes back non-empty, it is safe to modify it.

But most people just sleep for "long enough".

Since we are talking about "at", another solution would be just to schedule a one-time at job for 5 mins in the future to perform the crontab modification.

DarkHorseDre wrote:

One question I have: does the command "at NOW +5 blah.." run the update & then creates a job for 10 minutes?
If so, does it not loop and create many jobs? I guess I'm just not understanding how the command to create a job of itself will self-sustain without issue.  I assume its ok, but just checking!

The at command simply *schedules* a job.  It returns right away after scheduling a job.  If there were more commands in the script after the at command, they would execute.  But in this case the shell running the script simply ends and leaves the system.  Later, when the five minutes are up, the at daemon simply runs the script again, which results in a new scheduled execution of the script in 5 more minutes, and so on.  The script is not getting called recursively.

Last edited by karlrado (2010-11-03 21:48:24)


DNS-323 FW 1.07 : 2 1TB WD Caviar Green SATA : fun_plug: utelnet + optware (no ffp)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB