Results 1 to 5 of 5

Thread: Configure computer to automatically send IP by mail

  1. #1
    Join Date
    Sep 2007
    Beans
    67
    Distro
    Ubuntu 12.04 Precise Pangolin

    Question Configure computer to automatically send IP by mail

    ok, I've been trying to figure this out and googling on different occasions is been fruitless, so I'm hoping someone can point me in the right direction here.

    I have a netbook that I like to leave online behind a router that gets a dynamic WAN IP address.

    I have already set up the router to give this computer a static port and to forward ports 22 and 5900 so I can ssh and vnc to it (vnc closed and can activated thru ssh).

    So, what I want is to set up the built-in mail (aka xmail or mailx) to send me an email if the IP changes (or send me the current WAN IP every 6 hours or something), also it'd be awesome if it would send me the battery state.

    Is there a way to do this?

  2. #2
    Join Date
    Dec 2011
    Beans
    2

    Re: Configure computer to automatically send IP by mail

    Just add a job to cron to run a script with:

    wget -O - www.whatismyip.org | tail | mail whatever@whatever.com

    You can pipe that into any send mail program that you have setup.

  3. #3
    Join Date
    Sep 2007
    Beans
    67
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Configure computer to automatically send IP by mail

    thanks! that will probably work, but I guess I forgot to add that I don't know which command to use to configure the smtp server of mail. Or can I just configure the default mail client graphically and will it take the same configuration? (although I'd prefer to do it by bash).

  4. #4
    Join Date
    Dec 2011
    Beans
    2

    Re: Configure computer to automatically send IP by mail

    Not a problem. You can install sendemail from apt-get (sudo apt-get install sendemail).

    Then just setup your script to run:

    Code:
    wget -O - www.whatismyip.org | tail | sendemail -f from@address.com -t to@address.com -s smtp.server.address
    No other configuration needed.

  5. #5
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    7,701

    Re: Configure computer to automatically send IP by mail

    I would prefer
    GET www.whatismyip.org | sendmail
    GET doesn't produce the progress dialogue that you're stripping again.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •