Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run URL in Perl script 1

Status
Not open for further replies.

blarneyme

MIS
Jun 22, 2009
160
US
Running Dynamic DNS and having problems with zoneclient.py and also with ddclient because I can't install some needed modules.

Therefore I am updating the site using the url which works fine, but I want to put it in cron. So my question is how do you execute a URL from a script so it will update the IP if the dynamic IP changes?

I've tried this but not sure it really runs it:
Code:
#!/usr/bin/perl 

use LWP::Simple; 

my $url = '[URL unfurl="true"]http://dynamicdns-park-your-domain.com/update?host=yadda&domain=example.com&password=123456abcdef';[/URL] 
my $content = get $url; 

print $content;
 
does it really have to be perl doing this?

maybe it would be simpler to just use wget. i'd be surprised if it wasn't installed.

since cron is taking care of this, i figure you don't have much need for the actual content returned from calling the url.

i'd just have cron execute:

Code:
wget -O - '[URL unfurl="true"]http://dynamicdns-park-your-domain.com/update?host=yadda&domain=example.com&password=123456abcdef'[/URL] >>/dev/null

the "-O -" makes wget print output to stdout which is redirected to /dev/null. of course you could also use "-O myOutfile.htm".

regards

michael
 
in case it has to be perl und you don't mind using wget, you could also do
Code:
my $content = `wget -O - '[URL unfurl="true"]http://dynamicdns-park-your-domain.com/update?host=yadda&domain=example.com&password=123456abcdef'`;[/URL]

not tested, but you get the idea. good luck :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top