Get an email when your public ip changes on Linux

Sometimes it can be very handy to get a notification from your system when the public ip changes, for example when hosting a site or ownCloud locally. Some domain registrars can help you with DDNS installs, but there are also cases where this is not possible and you have to do all DNS entries by hand.

Before we install a simple script we will have to make sure that we can send mail from our system. Follow the tutorial Mail forwarding on linux.

Now we are all set up and ready to go. In case you think you will start using more scripts it is handy to make a folder for that and put all your scripts in there:

This will open nano editor with a blank file. Now copy and paste the following:

Save and close the file.

Now we have to make it executable:

That was it. Now run it, and you will have received an email with your IP.  You could now make a cronjob of it.

3 thoughts on “Get an email when your public ip changes on Linux

  1. Very very nice!!! Going to use it immediately!

  2. Btw, you can merge the mkdir lines into one using this:
    mkdir -p Scripts/IPMailer
    This will make the parent directories if needed.

  3. Oh, and this one is nice too: https://github.com/graysky2/checkip

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">