FTP backup script

If you have a remote web server, then for a small fee, your hosting company will back it up for you.  This is money for old rope.  If you run Linux at home, then you can back it up yourself – just by transferring the contents to a local folder on your computer using a shell script that performs the ftp transfer, which can be fully automated by adding it to cron (crontab -e)

HOST=’ftp.mywebserver.co.uk‘ # change the ipaddress accordingly
USER=’myftpusername‘ # username also change
PASSWD=’myftpuserpassword‘ # password also change
ftp -n $HOST < quote USER $USER
prompt off
cd /www # this folder contains files to be backed up…
lcd /webserverbackup # this location is the local directory to backup to.
mget *

Don’t forget to change the username, password, ftp server name/ip address and remote and local mount points to suit your requirements.  And don’t forget to chmod +x the ftpbackup.sh script to make it executable.  Finally use crontab -e to add a scheduled job to run this script automatically.  You can also add to it in order to create a readable log file or to warn you via email in the event of an error.



Adding additional mailboxes to Outlook

If you want to add an additional mailbox to Outlook, e.g. a shared mailbox for your team to view alongside your regular Inbox, then follow the following instructions.  It’s not intuitive, requires an understanding of the context of what you’re actually doing in Microsoft lingo, i.e. You are adding an additional Mailbox to your existing Outlook Profile, not adding an Additional Mailbox to Outlook per se, (which is done outside of Outlook via the Mail icon in Control Panel and effectively creates an Additional Outlook Profile which you’ll be prompted to choose from each time you subsequently start Outlook).

Tools, Account Settings

Highlight your Account, and click Change (the bit that isn’t obvious / intuitive in my opinion).

Click on More Settings in the lower right hand corner.

The Mailboxes dialog appears and may well be blank.  Click Add to add additional mailboxes.  You’ll likely need to know the name of it.

The additional mailbox will now be added to the folders treeview pane in Outlook in your existing profile.


Virtual CDROM Drive / External HDD

Behold the Zalman ZM-VE200 (branded internationally as IODD) – a 2.5″ HDD enclosure that has a neat trick up it’s sleeve – the ability to present .iso files written to its _iso folder as if they were a CD/DVD i.e. Virtual optical drive technology.  Saves carrying around a pocket full of scratched cd’s.  Just download the .iso and boot off it.  No burning to CD first, and perfect if there’s no cdrom drive present (but requires boot from usb capable bios).


It’s worth mentioning the default firmware supports ntfs out of the box – i.e. unless the drive is formatted with an ntfs filesystem, the virtual cdrom drive folder _iso will not work.  ntfs is a good choice since both windows and linux (desktop distros at least) can read it these days and unlike fat32, it supports large files – necessary for storing bootable dvd isos.  If fat32 is absolutely necessary for universal compatibility though, you can download and install the firmware to make it work in fat32 mode instead of the ntfs mode that it ships with.  If I recall, this involves downloading the firmware file to the _iso folder and booting off it – but check the documentation on the zalman website.  It’s a simple procedure, but will limit the size of the iso that can be written to the disk.  Having converted mine to fat32, I might go back to ntfs firmware.  I have multiple storage devices so there’s always something formatted with fat32 kicking about if necessary.


Mobile Broadband

One problem with contracting is that you’re never in one place long enough to sign up to long contractual agreements with broadband providers, and hotel wi-fi is expensive.

My latest assignment is 242 miles from my home which is a little uncomfortable to commute every weekend, so I’ve sought a suitable rented property on the edge of the Peak District.  Lovely.  The only thing is with such remote locations, the broadband services are generally rubbish.  A check of the postcode on Virgin’s website already alerted me to the pee-poor-promise of 1.6Mbps for £23.99 per month.  Ouch.  I needed to consider alternatives.

I already have a smartphone.  Being more practical minded than fanboy, I’ve opted for the Motorola Razr MAXX.  It isn’t up for debate.  It’s the biggest battery of any smartphone on the market and that alone makes it the best.  The rest is all BS so take your S3’s and your iPhones and do one.  It also comes with a neat little Motorola HD Dock (purchased separately for £23) which allows me to use it with my 24″ monitor, and Motorola bluetooth keyboard and mouse (also purchased separately for £23) and use Motorola’s WebTop, effectively giving me PC functionality.

The best bit though is my careful choice of mobile contract.  I’ve gone with a £25/mo deal with Three called The One.  It’s their flagship deal apparently, and I think I’ve got the best option of the best deal having opted for the 1 Month SIM Only version (with micro sim for my handset) for the ultimate flexibility in the future instead of being locked into a 2 year contract.  The only 2 year contracts I’m interested in signing up to are the ones where I’m the one getting paid.

In return for my hard earned.  I get…

2000 minutes talk time

5000 3-to-3 minutes talk time

5000 text messages

All-You-Can-Eat data with Internet Tethering included.

You have to be careful though.  This plan DOES include tethering, whereas many others – even with the same provider DO NOT.  You have tethering capped at 1Gb, or have to purchase a Tethering addon to go with your AYCE data addon.  Having done some reading around, it really only seems to be this package that is inclusive of tethering, which means I’ll avoid the necessity to pay for phone or broadband services to the residence, saving money (£25 with virgin broadband in my non-cable area).

I checked my area for coverage and it seems OK.  Even though 3 boast 80% coverage in the UK, you still have to check, right down to the street level.

This combination of mobile handset, optional gubbins and 3’s tariff is as good a setup as I can find for a contractor potentially on the move every six months.

More info here…


and here…


UPDATE:  I’ve been using my mobile phone for a couple of weeks now as my one and only source of internet.  It has impressed me immensely.  I have found that the best way for me to use it is to use USB Tethering to my Desktop (much more reliable for multi-part downloading of larger files, such as tv episodes and .iso images) and simultaneously enable Mobile hotspot to allow additional devices such as PlayStation 3, laptops, other mobile phones to use the internet services by Tethering over WiFi.  This is great, as my most intense usage is usually a combination of playing GT5 Seasonal Events on the PlayStation while I wait for downloads to complete on the PC.  OK, so it all takes a little longer than it did at my main residence where I have 30Mb/s cable broadband, but it really isn’t bad.



Combining multiple columns into one in Excel

This is the easiest way to take the contents of multiple columns and combine them into a single column.

My example uses the ip address where each octet and each . between each octet exists in a different column.

Choose a cell, and enter the following formula…  It’s just like doing a SUM to add numbers, only you use CONCATENATE instead.

Hit enter and voila.











Edit wbar dock and conky in crunchbang/openbox

Besides editing the menu.xml to customise the menu, why not install wbar and edit /usr/share/wbar/dot.wbar to add convenient quick launch icons to the wbar dock for the most commonly called upon apps.  It’s even simpler than editing the menu.xml file, especially if you use vi.

My desktop is quite nicely themed and as conky shows, is very light on resources.

conky – the monitor on the left hand side of the screen can be customised by editing .conkyrc in your home directory.  To install it, simply type sudo apt-get install conky then get hacking.

To effect the changes, simply right click on wbar, or restart the conky process using kill -HUP


Configuring an Excel ODBC Data Source in Windows 7

A very neat little trick  to compare tables of data in Microsoft Excel to reveal differences, is to highlight the data (all rows and columns containing data), and Define a name for the data, then use an ODBC Driver for Excel to subsequently query the tables as if they were a database.

Each tab in the Excel Workbook can contain a different table of (similar) data and the tables can be linked in Microsoft Query Editor so that SQL queries can be performed against the linked tables to reveal all rows of  data where the same information exists in two separate columns of two separate tables, or even more useful (in my experience) the rows of data where the data that exists in one column of one table doesn’t exist in the other.

In Windows 7, the Data Sources (ODBC) management console will only show drivers for SQL Server, and not the list of different drivers seen in previous versions of Windows.

In order to create an Excel Data Source, you need to close the 64-bit version of the management console and run the following instead..

In the 32-bit odbcad32.exe (shown below), upon clicking Add, you’ll see the long list from which you can choose Excel Driver and point it at your spreadsheet that has the defined data within it.



Note, if you intend to use this method to query the data in multiple Excel tables using the Query Analyzer, you will have to save a copy of the workbook in the older Excel 97-2000 .xls format before you create an ODBC Data Source for it.

Upon returning to Excel, Create a new tab in the same workbook or create a new Workbook if you like, and Open Query Analyzer as shown…

Choose the Data Source Name (DSN) created using the 32 bit ODBC dialog, choose what tables (Definitions) you wish to include in your query and manually join the tables containing the similar data, then edit the SQL statement as required (usually just changing = for <> produces the sort of results I’m looking for, i.e. differences between the two columns, not similarities.

My personal preference when it comes to comparing columns of data is to export the columns to separate text files, WinSCP the text files onto a Linux/UNIX machine, then use cat | sort | uniq on each file, then comm (not diff) to perform the comparison and show entries in one but not the other of the two files being compared.  I’ll endeavour to cover this method in another post to compliment this Windows 7 oriented post.


Edit Openbox menus in Crunchbang Linux

Unlike some of the heavier, fully functional desktop environments typically provided by the top five on Distrowatch, Openbox used by Crunchbang will not always automatically add the names of newly installed programs to the menu used to subsequently invoke them.

Most folks who are not as far down the rabbit hole as I am, understandably just want a desktop that works but they should pause for a moment before turning off to the idea of Openbox and Crunchbang for the following two reasons.

1. It makes full disk encryption (not just your home directory) available to you during installation which is very reassuring if you should get your laptop stolen.

2. Each time I consider parting company with it and going back to a heavier distro, I find I can’t bring myself to do it because it does everything I need it to.  Plus it does it more efficiently and in as minimalist a way as my puny hardware resources could ever hope for, so why would I?

On top of the Linux kernel, you’ll already be running sufficient packages put into place by the installation procedure to provide a working desktop environment that handles a bunch of important stuff you won’t have thought about, such as handling removable devices such as usb sticks, encrypting the files that get written down to disk, searching for wireless lans or sending a DHCP request if you plug into a network in the hope that it’ll learn of some nearby DNS servers so that your web browser will work when you ask for google.com, but depending on how lightweight your chosen distro is in nature, it may not have much else.  Crunchbang is one of these.  It does the hard stuff up front, and leaves you with a pretty blank canvas on which to build and have fun.  For those of you who say I only need web and email, that’s nonsense. There’s a whole bunch of stuff you need for web and email at the application level to work properly but rest assured Crunchbang already provides it, despite it’s blank, black appearance.

It’ll even keep on working when you find yourself needing to do real work. I have to successfully run my own company using just my laptop during the week when I’m away from my home and the rest of my infrastructure and also use it for entertainment so there’s really no better test than that. Reviews are great, but the proof of the pudding is in the eating. I want to get the work done, and that means I want a fast, super responsive interface that doesn’t mess about. My laptop isn’t for impressing my friends with, it’s key to my survival and my only source of free entertainment. It has to deliver and if it comes up short, I will find out quickly. I also like messing about with photographs so those extra system resources are appreciated.

Additional functionality comes in the form of freely available modules (programs and their dependent libraries) installed and removed at will using Synaptic Package Manager which downloads all the software you’ll ever need from known repositories as and when functionality is required or retired on your desktop – much like your iphone or android phone, only crunchbang doesn’t carry the advertising or any of the bad stuff that leaves you wondering if your computer is actually free or even your own.  Install it and you’ll see much blackness!  No childish fisher-price icons here to lure in paying consumers, just a blank, black canvas and a package manager.  That’s as simple as it gets.

BUT, as I started out saying, it won’t necessarily add the programs to your desktop menu after they’re installed.  Before you let that become an issue for you and miss out on feeling like that kid felt in the 70’s when he/she opened that box and smelt that plastic, read on.  It’s easy to edit the menu to add the programs you’ve just installed.


Settings, Openbox, Edit menu.xml (not Reconfigure as shown – thats for afterwards).

The menu.xml file will open in geany text editor.  Anything between <item> and </item> is a, well, item.  So copy an existing block of code and paste it in somewhere appropriate according to what type of program it is (Media, Office, Graphics etc), then just modify the label and executable as required.  I added the xcalc calculator (shown below).

When you’re happy with your edit, save it, then Settings, Openbox, Reconfigure to re-load the .xml file you just modified and see the new item in the menu.  Test it to make sure it works.



Teaming Management NICs

The vmware esxi hypervisor with multiple nics can be configured a multitude of ways depending on the number of nics on board.

My lab hypervisors only have two, but that is enough to present a choice in itself, between splitting management, vmotion and iscsi traffic or alternatively teaming the two nics and putting all vmkernel ports, storage adapters and management traffic over a common active-active bonded link.

The lab environment has been running flawlessly for months with a physical split configured between management and vmotion/iscsi networks so I thought I’d configure up the “alternative” scenario and let that run to see how things go.

One thing to look out for when reconfiguring the networking on the ESXi hosts (apart from making sure all names of vmkernel ports match perfectly like before) is that the physical nics are both active afterwards.


Note one nic is in standby.

One of mine did it automatically, the other one didn’t.  This left me in an unforeseen situation whereby I wouldn’t have been getting the full bandwidth benefit of both nics on one of my hosts while attempting to run everything over a single nic.  This is definitely not recommended although in test, vmotion was still rapid -most likely due to very little else going on.

This would not be the case in a production environment and I’d certainly recommend migrating all your guests from any host that is being reconfigured and put it into maintenance mode.  I didn’t do either of these things but that said, the whole point is to push my lab to breaking point and document the experience – which is what happened.  More on that later.


Click on Move up, to make the second vmnic active.

With both nics active, you should see the following…

…both nics become active.

This change will possibly also require you to connect to the local console of each esxi host and manually restart the management network.  This is certainly the case for earlier ESXi 4.0.0.

Upon removing the second vSwitch my ESXi host lost connection to the iSCSI datastore and thus the virtualcentre vm’s hard disk etc.  Ordinarily this would not be a problem since in a clustered environment the other ESXi host would restart the guest, however the network configuration was in mid-change and thus did not match on both hosts in the cluster.  This is called “Proper breaking it” from where I’m from but is where the real learning happens.  Let it be in your back bedroom though and not on the datacentre floor.  To recover from the situation I first attempted to shut down the vm using the unsupported console (covered in an earlier post), which the esxi host said was still powered on.  It did not want to power off, or power on, or reset.  In fact the esxi host didn’t want to reboot either so it got a hard reset in the form of me pushing in and holding in the power button and wondering if I’d have to build an out of band vm to install vsphere client on so that I could complete the network configuration of the esxi host.

After reboot, I’d noticed that the cluster had restarted the guests including the virtualcentre server on the other healthy host which I thought was pretty impressive since it saved me a bunch of hassle.  This enabled me to continue reconfiguring the new vmotion vmkernel port on the bonded nics.  A quick check over suggested everything was consistent except I’d lost visibility of the iscsi target.  A quick rescan and it re-appeared and a successful vmotion of my DLNA server in mid-flight proved it was all healthy again.  I’ll see how well it behaves unattended over the next few weeks / months.  I’d like to know how I might force a rescan down the virtual iscsi storage adapter for the iscsi target where the datastore resides from the unsupported console though.  I wouldn’t be surprised to find out it can’t be done, in which case I’d find myself installing vsphere client on another machine and doing it using the gui.


Setting a Round-Robin Fibre Channel Path Policy on ESXi

If you’re DataStores are using Fibre channel storage and you have multple fchba’s connected through to the SAN via a fc switch or two, then it is prudent to optimise the IO potential of all the redundant hardware by changing the fc path policy to “round robin”.

Using vsphere client, connect to the ESXi host / vcentre server

Inventory, Hosts and Clusters, select ESXi host

Configuration tab, Storage, highlight the datastore, click Properties

Click Manage Paths button on the DataStore properties dialog

Change Path Selection to Round Robin (VMWARE) – the default is Most Recently Used (VMWARE)

Wait for the screen to reload, Click Close

Repeat for each DataStore, and then Repeat for each ESXi host.