IP address notification for VNC sessions
Cef
cef at optus.net
Fri Feb 11 00:46:13 UTC 2005
On Fri, 11 Feb 2005 09:50, Thomas Kaiser wrote:
> Put a file named newip (or similar) into /etc/ppp/ip-up.d/ with the
> contens:
>
> #!/bin/sh
> ifconfig |grep xxx.yyy | mail -s "New IP" somwone at somewhere.nnn
>
> xxx.yyy are the first part of the ip number. This should be always the
> same even your ISP changes them dynamicly.
Re: IP ranges: This is not guaranteed, especially since many large ISP's have
absorbed smaller ones and in the process absorbed their IP allocations. Also
when an ISP gets absorbed, or the internal network management undergoes an
overhaul, the entire allocation pool could change. Moving ISP's also then
requires you to change stuff. This is annoying from a support perspective.
You're better off grepping for the string 'inet addr:', as that should always
contain the ipv4 address of the system.
However, there are a number of variables that contain various details of the
connection that are available to scripts in /etc/ppp/ip-up.d/, so grepping
isn't necessary in this case. The following should work, assuming that mail
works properly:
#!/bin/sh
echo $PPP_LOCAL | mail -s "My New IP" name at domain.xyz
Good luck!
--
Stuart Young - aka Cefiar - cef at optus.net
More information about the ubuntu-users
mailing list