Posts about {'title': 'blog'} (old posts, page 2)

Ubuntu Dynamic MOTD

I'm just finishing off moving all my web sites and related things from one VPS host to another. The new host had customized the message of the day on the Ubuntu 12.04 LTS image which I had installed. It had helpful links to support and what not, things that are only actually helpful the first time I logged in.

As I went through the process of removing all this I had to learn about the update-motd system, since I quickly found that the solution wasn't a simple:

[sourcecode language="bash"]$ sudo echo "" > /etc/motd[/sourcecode]

So I cooked up a bash script to spit out some information about the system every time I log into the server. The output looks like this:" width="387" />

Create or edit update-motd's 00-header file.

[sourcecode language="bash"]$ sudo vi /etc/update-motd.d/00-header[/sourcecode]

And here's the source of the bash script:

[sourcecode language="bash"]#!/bin/sh

[ -r /etc/lsb-release ] && . /etc/lsb-release

if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
# Fall back to using the very slow lsb_release utility DISTRIB_DESCRIPTION=$(lsb_release -s -d) fi

UPTIME=`uptime | awk '{if ($4 == "day," || $4 == "days,") print $3, $4, $5; else print $3}' | awk -F: '{print $1, "hrs", $2, "mins"}' | sed 's/,//g'`

LOADAVG=`uptime | awk '{if ($4 == "day," || $4 == "days,") print $10, $11, $12; else print $8, $9, $10}'`

PROCCOUNT=`ps -l | wc -l`
PROCCOUNT=`expr $PROCCOUNT - 4` IP=$(/sbin/ifconfig eth0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}')
echo -e "
==============: System Info :=================== Hostname: hostname Address: $IP Distro: $DISTRIB_DESCRIPTION Kernel: uname -r Uptime: $UPTIME Load Avgs: $LOADAVG Processes: $PROCCOUNT ==============: Memory Info :=================== Total: cat /proc/meminfo | grep MemTotal | awk {'print $2'} kB Free: cat /proc/meminfo | grep MemFree | awk {'print $2'} kB Lowest: cat /proc/meminfo | grep LowFree | awk {'print $2'} kB ===============: Disk Info :====================" df -h[/sourcecode]

Hyper-V 2012 Failover Cluster: Live Migration Fails

I love hyper-v. I especially love hyper-v running on windows server 2012 in a failover cluster configuration. It truly is a wonderful environment to administer windows servers. With this said, the error logging leaves a lot to be desired.

I've just spent the better part of two days trying to work out why live migration of servers between cluster nodes wasn't working. The error message which Microsoft helpfully give you when this happens is simply: Event ID: 21502 Source: Hyper-V High Availability ’Virtual Machine <VM NAME>’ Live Migration did not succeed at the destination And over on the hyper-v host you were trying to migrate the virtual machine onto you'll get the equally as amazing Microsoft-Windows-Hyper-V-High-Availability-Admin log entry of: Source: Microsoft-Windows-Hyper-V-High-Availability Event ID: 21111 Description: Live migration of 'Virtual Machine <VM NAME>' failed. Oh thanks, it didn't work because it failed.

Finally after reading many a technet article and support thread I stumbled onto the fix. It was simple. Here's the details for anyone else who suffers this problem:

  • On any node in your hyper-v cluster, open up Failover Cluster Manager
    • Select the cluster name
    • In the bottom right corner of the manager window, click Take Offline

    System Message: WARNING/2 (<string>, line 20)

    Definition list ends without a blank line; unexpected unindent.

    • Again in the bottom right corner, under More Actions, click Repair
  • This will bring the cluster back online and magically fix the mysterious problem causing live migrations of VMs to fail

Best of all, it will do this with out any disruptions to running VMs. Enjoy!


I recently posted a long ramble about being very late to the smartphone "evolution". One reason, of many, which I'd held off for so long was because I could predict the amount of time I'd "waste" messing around and tinkering with the phone and the apps installed on it. I was right.

I'm sure that it won't really be news to anyone that Flipboard is an amazing app. I'm such a fan of feed based news and information ingestion that I have used my own rss aggregator for years, so obviously one of the first apps I needed to find was an rss / news reader. Flipboard won out over Google Currents and the handful of other rss readers I checked out.

With that said, I had to put together my own specially crafted rss feeds to be truly happy. What I've done is create new feeds of my favourite sources using yahoo pipes which have images included in the body of each post, so that Flipboard displays the image, headline and snippet in a good looking way. I then added these rss feeds to my Google Reader account. While Google has announced that Reader is being killed off in July, it is currently the best way to get new feeds added to Flipboard. Just add your G.Reader account in the accounts settings in Flipboard. Then you can add each separate feed to an icon link on the main Flipboard screen for easy access.

Here's the list of feeds which I've created:

System Message: WARNING/2 (<string>, line 11)

Block quote ends without a blank line; unexpected unindent.