Mar 232012
 

I recently built a HTPC box with Ubuntu 11.04, and then after updating to 11.10, I couldn’t get it to auto login into an XBMC session anymore with LightDM.
However, I found this command which may come in useful for anyone trying to do the same thing.


sudo /usr/lib/lightdm/lightdm-set-defaults --session xbmc

Share
Mar 112012
 

Recently I had some issues with my free DNS service, it wasn’t updating my DNS so I couldn’t access my server remotely.
After this happened a few times, I decided to modify one of the configuration files so that it would email me my external IP address each time the PPP connection came up. This ensured that I would get the latest IP address emailed to me ASAP.

What You Will Need :

Sendmail or equivalent on the linux box that you doing this on.
The PPP connection needs to be on the linux box also for this tutorial, however I will write up a guide that uses an external website instead later on.
A commandline mail sending program, I have used mailx in this example, which is symlinked to mail.

How To Do It :

To do this, I added a file in this directory ( on my Debian System ) –

/etc/ppp/ip-up.d/

which I have named “EmailIP”.
Scripts in this directory are run when the ppp connection goes up.

The file contains the following line which does the gruntwork

echo Connection has come up - New IP Address : `ifconfig ppp0 | grep inet | awk -F' ' '{ print $2 }'|awk -F: '{print $2}'` | /usr/bin/mail -r <From@example.com> -s IP-Address <Email@example.com>

What that command does is pipe the text “New IP Address : ” followed by the output of ifconfig ppp0 which is then grepped down to the inet line, and then awked down to the actual IP address and pipe it into the mail command which can send an email via sendmail or whatever mail daemon you have installed.
The sendmail command has the following parameters specified –
-r : specifies the address that the email appears to be coming from (From@example.com in the example)
-s : specifies the subject of the email (IP-Address in the example)
Email Address (Email@example.com in the example)

Then once you have the script in place, when the ppp connection goes down then comes back up, you should get an email to the email address you specified with the text “Connection has come up – New IP Address : <Your New IP Address>

Share