Summarizing dig Info with a bash script.

Dig is a great tool, but most of its output is not very interesting. There are a bunch of command line options that I can never remember without a quick 'man dig' which always sounds a bit odd. So I whipped up a quick script. It takes a domain name as the argument, and then pumps out the Reverse IP lookup, Nameservers, and Mail servers with reverse lookup of their IPs.

#!/bin/bash
QUERYDOMAIN=$1
echo "Reverse IP:"
 echo "    " `dig x +short $QUERYDOMAIN`
 echo "Nameservers"
 NAMESERVERS=`dig ns +short $QUERYDOMAIN | sed "s/^[0-9]* //g"`
 for SERVER in $NAMESERVERS;
 do
 echo "    " $SERVER " = " `dig x +short $SERVER`;
 done
 echo "Mail Servers:"
 MAILSERVERS=`dig mx +short $QUERYDOMAIN | sed "s/^[0-9]* //g"`
 for SERVER in $MAILSERVERS;
 do
 echo "    " $SERVER " = " `dig x +short $SERVER`;
 done

The output looks like this:

Read more

Munin, nginx, mysql on Ubuntu 11.04: Great tool. Poorly explained.

Well I just jumped through the hoops again installing a new tool, and as it took me quite a while, I thought I'd help the Internet at Large through it. Or at least make a few notes, as most of my own searches for information on this drew blanks. I even went to the lengths of translating a few obscure German posts in case they could help.

Anyway, munin, once you get it going, is actually quite cool. It provides you with a graphical look at your server performance, and you can customise which data you collect quite simply. I'm installing it on an Ubuntu server 11.04, with nginx and mysql. I'm expecting a big traffic spike in the near future, so I want to see how the machine is handling it, and which bits, if any, are struggling.

Read more

Ubuntu 11.10, Unity, Gnome 3 and the whole mess

My main work machine is still on Ubuntu 10.10. I had installed 11.04 on my spare laptop, but hated Unity so much I only ever booted into Gnome Classic. I was hoping things might get better with 11.10, but things are now very much worse. To the point where I'm looking around for other distributions. I suspect, like Linus Torvalds, I might start looking at XFCE.

Anyway, after upgrading my laptop to 11.10, I was disturbed to find it wouldn't boot up: you just sit there looking at a message which says "Waiting for network configuration". I'm fairly techy (and have a spare computer), so I was able to find the answer, which was to drop to a shell and move a bunch of files from /var/run to /run. But imagine a non-techy person trying to cope with this. Congratulations Ubuntu, you just lost market share.

Read more

Cleaning a virus off a Samba Share.

One of the problems of running a Samba share on Linux is that occasionally one of the Windows machines accessing it will get a virus, and infect all the files on the share. You can use one of the AV tools to do this of course, (Clam AV, AVG and Kaspersky all have them these days) but they're pretty slow generally.

I noticed at one client that the virus was putting exe files into directories, with the same name as the containing directory eg.it would create the file /share/Software/Software.exe.

So the first thing to do is to see who is creating them. Here we go …

Read more