Shell script to send your ip by mail

Needing to connect via ssh to my work desktop from my home laptop, I developed a simple shell script that write IP information in a file and then send it by e-mail.

The execution of the script can then be scheduled with Gnome Schedule so that you are notified each time your external or local IP address changes.

Download the whatsmyip script.

Install dependencies

sudo apt-get install sendemail

Setup keyring

If your outgoing mail service requires identification I would recommend to install the gkeyring script, and copy it to the same directory as the whatsmyip script (last version available at https://code.launchpad.net/gkeyring/). This way you can use the gnome keyring to store your password instead of having it in clear text in the script.

To set it up:
./gkeyring.py -p whatsmyip=1 -1 -w PASSWORD

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s