 |
 |
adv IP Report
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Apr 2001
Location: The Moon
Status:
Offline
|
|
Hi,
Could somebody please help out me with a script. It should
1) Check if DHCP is up (not 169.xx.xx.xx), if not release and re-init the DHCP, if IP has changed ->2
2) Report IP to a FTP.server
well here is why ...
The problem with my ISP (Cable) is that from time to time (weekly) they shutdown a router or something so my DCHP connection is dropped and OS X is assigning an ip itself (169.xx.xx.xx). No Problem if I am around. But what if I am away ? Even-worse they changed afterwards my IP to something different ...
(Last edited by Samanoske; Sep 6, 2003 at 07:47 AM.
)
|
|
.- OS X aDDICTED -.
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Apr 2001
Location: The Moon
Status:
Offline
|
|
Ok I know how to renew the DHCP,
sudo ipconfig set en0 BOOTP
sudo ipconfig set en0 dhcp
but I have no idea how to compare the ip
|
|
.- OS X aDDICTED -.
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Apr 2001
Location: The Moon
Status:
Offline
|
|
Ok .. after a small fight with the csh shell, and I have to admit the Manuals on the net are very helpful - I succeeded
what do you think to my little script ...
#!/bin/csh
ipconfig getifaddr en0 > IP
set uno = `awk -F . '{print $1}' IP`
echo $uno" as first IP Numba"
if ( $uno == '192') then
echo "We Are Laned"
else if ( $uno == '169') then
echo "We don't have a DHCP Connection"
echo "tryin to re-establish"
while ( $uno == '169')
sudo ipconfig set en0 BOOTP
echo "tryin to reach DHCP Server in few sex"
sleep 3
sudo ipconfig set en0 DHCP
sleep 12
ipconfig getifaddr en0 > IP
set uno = `awk -F . '{print $1}' IP`
end
echo "We have a Connection back"
echo "Copying IP to FTP Server"
ncftpput -E -u <Login> -p <Password> <Ftp.Server> <ServerFolder:/IP/> <File:IP>
endif
ofcorse I get rid of the echos for the the final-cron-job-script but they helped to script it
Report this post to a moderator | IP: Logged
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Mar 2000
Location: Bronx, NY 10471
Status:
Offline
|
|
i know this is a little off-topic of unix, but why dont you use something like dyndns.org. Check it out
Mel
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Apr 2001
Location: The Moon
Status:
Offline
|
|
Originally posted by melman101:
i know this is a little off-topic of unix, but why dont you use something like dyndns.org. Check it out
Mel
Originally posted by Samanoske:
The problem with my ISP (Cable) is that from time to time (weekly) they shutdown a router or something so my DCHP connection is dropped and OS X is assigning an ip itself (169.xx.xx.xx).
Well if the connections is dropped and I have a selfassigned IP, I can not report any IP. 
|
|
.- OS X aDDICTED -.
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |