Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Run Perl ipUpdate Script at Startup - How?

Run Perl ipUpdate Script at Startup - How?
Thread Tools
Fresh-Faced Recruit
Join Date: Feb 2002
Location: Atlanta, GA
Status: Offline
Reply With Quote
Jan 21, 2003, 12:04 PM
 
Hi:

I'm trying to run a script at startup that sends my current IP address to a DNS, but am pretty clueless. I have the script, but don't where/how to install it to run automatically in the background.

I registered a domain name with dnsexit.com and they provided me with a Perl script to accomplish this. (http://www.netdorm.com/downloads/ipUpdate.tar.gz) I can run the script manually from the Terminal, although I have to type "Perl" before the name of the script.

I don't know where I should copy the script & config file, though, and how to enable it to run automatically. Any help would be much appreciated! ' (See Read Me file below.)

Thanks -

-Mark-


ipUpdate Read Me file:


You must have Perl version 5 and newer installed on your machine
to be able to run ipUpdate.pl program.

ipUpdate.pl and dnsexit.conf must be on the same directory. Otherwise
ipUpdate.pl won't be able to find the config file.

You need to change the login, password, host on dnsexit.conf file to
reflect your information. It is default to run as daemon that check your
IP every 15 minutes. If you don't want to run it as daemon, put daemon=no
in the dnsexit.conf file.


After making changes to dnsexit.conf, you can run command
>> ipUpdate.pl
to update your host ip. If it does not work, try
>> perl ipUpdate.pl

If you want to keep it running even after your shell window has exit, use command
>> nohup ipUpdate.pl &

It will run in the background, check your ip in the specified interval, and
update your IP to dnsexit.com.

http://www.netdorm.com/downloads/ipUpdate.tar.gz
     
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Jan 21, 2003, 04:53 PM
 
Have a look at Tip 3 at http://www.macdevcenter.com/pub/a/ma...cforunix.html.

If this is all greek to you, I might be persuaded to write the scripts and post them to this thread if the moderators have no objections.
     
mrmambo  (op)
Fresh-Faced Recruit
Join Date: Feb 2002
Location: Atlanta, GA
Status: Offline
Reply With Quote
Jan 21, 2003, 05:27 PM
 
>>Have a look at Tip 3 at http://www.macdevcenter.com/pub/a/m...acforunix.html.

Thanks for the tip, int69h, but the link appears to be dead right now.

And, yes, this is somewhat greek to me; I haven't done any programming or scripting in 10 years and never much at that. I've tried to handle it myself, but haven't had much luck.

Updates:
1) Now I can't even run the command from the command line; when I type >perl ipUpdate.pl, I get:
mark% perl ipUpdate.pl
Can't locate LWP/UserAgent.pm in @INC (@INC contains: /System/Library/Perl/darwin /System/Library/Perl /Library/Perl/darwin /Library/Perl /Library/Perl /Network/Library/Perl/darwin /Network/Library/Perl /Network/Library/Perl .) at ipUpdate.pl line 10.
BEGIN failed--compilation aborted at ipUpdate.pl line 10.

(line 10 reads: use LWP::UserAgent; )

2) The company that supports this site, dnsexit.com, said they'd love to have scripts for the Mac as they only have 4 non-Mac folks on staff. Their comments were:, "Actually, if you know program, it won't be too difficult to make a small program to do it. What you need to do is to post your login data and host to our Server.
If you try to type URL
http://www.dnsExit.com/RemoteUpdate....yourdomain.com <http://www.dnsExit.com/RemoteUpdate....yourdomain.com>
Make corresponding changes to the above information based on your account data. If you don't pass the parameter myip, we will use the ip of your network to update. "


Thanks in advance for any help -

-Mark-
     
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Jan 21, 2003, 06:41 PM
 
I'll get something together and contact the company. Don't these services usually provide something that runs all the time and reposts your IP to theei servers periodically so that their information stays accurate if your DHCP server gives you a new address?
     
Zim
Senior User
Join Date: Apr 2001
Location: Cary, NC
Status: Offline
Reply With Quote
Jan 21, 2003, 09:07 PM
 
I may not give you the correct syntax, but at a "birds-eye" level you are missing the Perl module LWP::UserAgent (think of it as a sort of plug-in).

sudo cpan install LWP::UserAgent

might work for you... or I may have installed cpan myself :-) (I can't remember)

otherwise its something like

perl -Mcpan install LWP::UserAgent

(corrections welcomed).

That might let you run the script by hand.

For your other problem you want to make your own startup item. Several previous threads in this group have covered this (also search for ipfw, in which startup items have been covered).

As a last resort, you could make a call to it from your .login file, if for example you launch Terminal at boot (not pretty but it is quick and dirty...)

Mike
     
mrmambo  (op)
Fresh-Faced Recruit
Join Date: Feb 2002
Location: Atlanta, GA
Status: Offline
Reply With Quote
Jan 21, 2003, 09:12 PM
 
Thanks for your responses -

Zim:
I will take your input and look through previous postings. Thanks for the details.

int69th:
I've forwarded the contact info onto you as requested. And, yes - the purpose of this script was to do just as you describe: monitor my IP in case it changes due to DHCP, and then post any such changes to their servers to ensure my domain name always points to my computer.

Much appreciation -

-Mark-
     
Zim
Senior User
Join Date: Apr 2001
Location: Cary, NC
Status: Offline
Reply With Quote
Jan 22, 2003, 11:26 AM
 
Doing what you are trying to do is the right thing to do, but as a backup you may want to look at

http://forums.macnn.com/90/mac-os-x/139721/best-way-post-dynamic-ip-addresses/

I use that script to post my current IP to my ISP supplied web-space.

Call it a sanity-check.

Of course it requires extra Perl modules too

Cheers,
Mike
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:34 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2