Featured Articles

Twitter

See a real time tweet map of w…

February 5th 2012 | Posted by

See a real time tweet map of where it’s snowing here: http://t.co/H0hu3EHB #uksnow

Centos

Remote shutdown on CentOS

January 29th 2012 | Posted by

Here’s a simple shell script to remotely shutdown linux servers on your network.

What you’ll need:

  1. A server to run the script from
  2. Something to execute the script – In my case the UPS activates the script when a power outage is detected. But, this could also be a cronjob or something similar
  3. SSH access between servers. See this post to allow SSH logon without requiring a password to authenticate
  4. The user you connect with should have permissions to execute /sbin/shutdown on the remote server

There are two parts to this script. First the script itself and secondly a text file containing a list of servers you wish to shutdown

The script:

PATH=/usr/local/bin
HOSTFILE=$PATH/servers
LOGDATE=$(date +%F_%T);
LOGFILE=$PATH/shutdown_$LOGDATE.log

for host in $(cat $HOSTFILE);do
echo "Shutting Down $host..." >> $LOGFILE
echo $(date) >> $LOGFILE
ssh -t alan@$host "sudo /sbin/shutdown -h now" >> $LOGFILE
echo "$host Shutdown" >> $LOGFILE
echo  >> $LOGFILE
echo  >> $LOGFILE
done

echo "Remote Shutdown Completed" | mutt -s "Remote Shutdown" -a $LOGFILE joebloggs@abc.com

When you execute the script it will loop through the list of servers stored in this text file:

server1
server2
server3
server4
server5
....

A simple log file is created showing the process, an e-mail is then sent with the log file attached.

Enjoy!

Centos

SSH login without Password

January 28th 2012 | Posted by

There have been a number of times I’ve found myself needing to SSH from server to server and would prefer not to use a password.

After running two simple commands you can SSH to a server without requring your username or password. The basic principal is to generate a public/private key pair which is associated with your user account. The public key is then copied to the destination server and used for authentication instead of your password.

In this example I assume you will be connecting from servera and connecting to serverb.

  1. From servera you will need to run ssh-keygen. This generates the public/private key pair

    alan@servera$<strong> ssh-keygen </strong>Generating public/private rsa key pair.
    Enter file in which to save the key (/home/alan/.ssh/id_rsa):
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/alan/.ssh/id_rsa.
    Your public key has been saved in /home/alan/.ssh/id_rsa.pub
  2. Use ssh-copy-id to copy the generated public key to serverb. This will append your public key to the list of authorised keys on the remote server in ~/.ssh/authorized_keys

    alan@servera$ <strong>ssh-copy-id -i ~/.ssh/id_rsa.pub serverb</strong>
    alan@serverb's password:
    Now try logging into the machine, with "ssh 'serverb'", and check in:
    
    .ssh/authorized_keys
    
    to make sure we haven't added extra keys that you weren't expecting.
  3. Now try and SSH to serverb
    alan@servera$ <strong>ssh serverb</strong>
    Last login: Sat Jan 28 10:01:59 2012 from 10.30.0.155

Assuming you followed the above steps correctly you should now be able to SSH to your server without requring a password!

iPad, iPhone, Windows

iCloud Bookmark Sync issues

January 4th 2012 | Posted by

Since iOS5 was released I’ve been struggling to get bookmark sync working properly. It seems quite a few people are struggling with it, particularly on Windows with Internet Explorer. I get the impression that Apple haven’t put quite the same amount of effort into iCloud Control Panel on Windows as they have on the Mac.

Since launch it all seemed to be working ok but after a little while I noticed that bookmarks weren’t updating correctly. And after trying various combinations of disabling and re-enabling bookmark sync on iPad, iPhone and in Windows it was apparent that nothing was syncing and I ended up with no bookmarks on iOS.

iCloudControlPanel iCloud Bookmark Sync issuesAt this point I noticed this yellow warning triangle over the iCloud Control Panel icon. There was no explanation to this icon and I’ve not been able to find an error log, but, I could only assume this was related to bookmark syncing as everything else was working correctly.

The best method I’ve found to get bookmark sync working with Internet Explorer properly again is this:

  1. Disable bookmark sync on all iOS devices
  2. Disable bookmark sync in iCloud Control Panel
  3. Sign Out of iCloud Control Panel
  4. Move all favourites into a temporary location. This should leave you with no favourites in IE
  5. Ensure your favourites are stored in the default location. Usual default for Windows 7 is C:\Users\[Username]\Favorites or C:\Documents and Settings\[Username]\Favorites for Windows XP – I read a comment on the Apple forums that suggested a greater chance of success if configured this way!
  6. Sign In to iCloud Control Panel
  7. Enable bookmark sync in iCloud Control Panel.
  8. Restore your favourites back to the favourites folder.

After a few moments, you should find an Apple.plist file in each subdirectory of your favourites folders. I believe this file is how iCloud keeps track of your favourites and what needs to be synced. It’s presence seems to suggest that bookmark sync is working properly.

  1. Re-enable Bookmark sync on your iOS devices.
  2. And voila!

I’ve then taken this a step further. With the help of Xmarks my bookmarks are now in sync across all browsers, all computers and mobile devices I use at home and at work!

Twitter

Happy New Year to one and all!…

January 1st 2012 | Posted by

Happy New Year to one and all! Here’s to a great 2012!

General

Happy New (Year) Look!

December 31st 2011 | Posted by

Well my blog’s been going for a little under a year now and I’ve decided it’s time for a change!!

So with the New Year fast approaching I opted for a theme called iBizTech LightWeight created by the guys over at Technology Tricks. They’ve produced five versions in various colours but only this version has been updated to supports widgets.

I wasn’t a big fan of the light colour theme but noticed that the images for the other four colours were included in the download. So I decided to make a few modifications to suit my site.

  1. Modified the CSS to use the orange skin
  2. The CSS used for the sidebar didn’t play nice with Twitter Tools so made amendments to make the hyperlinks work properly
  3. I didn’t really have the need for the ad banner so I replaced that with the social media icons
  4. The featured post item was something I liked the idea of but it didn’t seem very flexible. I replaced the featured post code with the Dynamic Content Gallery plugin as this allowed for making a post “featured” whilst editing it.

I’ve got a few modifications to complete so the theme can be used as a proper child theme. Once completed I’ll look into making it available for download.

With that I’ll wish everyone a Happy New Year!!

Computing, Windows

Bad placement of Lenovo T420 DVD eject button

December 29th 2011 | Posted by

I’ve been using the T420 for several months now and it seems to be a great laptop, up to the standards I’d expect from Lenovos business range.

However, one issue has been plaguing me, which, seems only to be a problem with this particular model. Unlike the T410 I had previously the button on the DVD tray is not flush. The result of this is whenever I pick up the laptop to say move from my desk to go to a meeting the tray pops open.

The button seems to be located in just the “right” position to be triggered whenever I pick the laptop. Ok, this isn’t the end of the world but its pretty inconvenient. Whilst scanning various forums for this problem I stumbled across a solution in the program called Toddler Keys. Toddler Keys is actually designed to stop children messing with you laptop but suits this problem perfectly.

Toddler Keys runs in the background in your notifications area restricting access to whatever you choose:

ToddlerKeys Bad placement of Lenovo T420 DVD eject buttonIn this instance I’ve simply configured Toddler Keys to “Lock Drive Doors” with that setting enabled the button to trigger the DVD drive is completely disabled.

For the amount that I use the DVD drive, which, is very very rarely this is the perfect solution for me. Just a shame Lenovo didn’t get this right in the first place!

Todder Keys can be downloaded here

Twitter

What a week, a lot of loooong …

December 15th 2011 | Posted by

What a week, a lot of loooong days in office! Can now add Access control system repair to the CV. Wires and PCBs everywhere this afternoon!

Space

Earth from the ISS

November 13th 2011 | Posted by

As I was reading through my probably too large collection of RSS feeds this morning I stumbled across a video taken from the International Space Station.

Take a look at this link for a stunning time lapse HD video of Earth taken from the space station!

Enjoy!!

iPad

iPad Gestures in iOS 5

November 11th 2011 | Posted by

Yes they’re back!!!

Before iOS 5 was released I like many others downloaded xCode to enable gestures on my first generation iPad. After upgrading my iPad to iOS 5.0 I discovered that gestures had gone. Don’t get me wrong there are bigger issues in the world but ever since updating my iPad I’ve found myself trying to close or switch apps using the gestures that just aren’t there anymore!

I don’t know whether gestures were intentionally ommited for the first gen iPad or it was a defect but I’m so glad they’re back!

After upgrading to iOS v5.0.1 (which of course you can now do over the air!) you’ll need to follow these steps to enable gestures:

  1. Go to Settings
  2. Go to General
  3. Enable the slider for “Multitasking Gestures”