Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Feb 2001 00:04:34 -0500
From:      "John Telford" <j.telford@sympatico.ca>
To:        <freebsd-questions@FreeBSD.ORG>
Subject:   Have my offsite boxes e-mail me their IP address when it changes ?
Message-ID:  <002c01c090c3$7715e540$022ce540@johnny2k>

next in thread | raw e-mail | index | archive | help
I have to support a remote Freebsd 4.2-R box that is attached via PPPoE.
From time to time it will automatically obtain a new IP address. I'd like
that new address to be e-mailed me to me by the system when it does change.
I have the startup part figured out, in rc.local I just put:
ifconfig tun0 |mail myaddress@mydomain.com
Seems to work fine.
I'm sure someone must have a script that can test and mail if it changes.
My (newbie) thoughts would be to first write ifconfig tun0 to file1 and
file2 at startup then cron a job that would:
    ifconfig tun0 > file2
    diff file1 file2
    if there are differences then ifconfig tun0 |mail myaddress@mydomain.com
    cp file2 file1 #make them the same again.
    else
    no changes
    done.
Anyone actually have something working ?
Thanks in advance, John.



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?002c01c090c3$7715e540$022ce540>