Tuesday, March 30, 2010

NET START and listing the service names

On Windows, I'd long known you could short-cut a trip to start->control panel->admin tools ->services, scroll through list of services, right click and restart by simply using cmd.exe and typing 'net start service-name'. What I didn't know was how you could enumerate the service names (a good example: different VNC servers might be called wvnc, vnc-server, and so on).

The answer: type 'net start' by itself to list them. Of course!

It's not exactly logical (I was thinking with net start and net stop, there might be a net list command but no, net start by itself lists them).

Oh, and if the service name has a space in it, you have to put quotes around the service name:

net stop "VNC Server"
net start "VNC Server"

Monday, March 29, 2010

Making Citrix appear in the Applications menu for Windowmaker on Ubuntu 9.10

I've gone back to WindowMaker, and am trying to make it Do The Right Things - specifically, display the level of functionality I had under KDE. So far it's all going pretty well. One niggle is that the system menus provided by the default installation don't play nice with the wmprefs tool. Wmprefs generates a prop list format, but the output of updates-menus is not in that format - presumably in the older one.

Anyway, what does it mean? Basically, that you can't manually edit the menus easily. Bit of a pity, but I can live with it. However... where's Citrix gone? It's not in the menus. To fix, add this:

?package(icaclient):needs="X11" section="Applications/Network"\
title="Citrix ICA Manager" command="/usr/lib/ICAClient/wfcmgr" sort="$" \

in a file called /usr/share/menu/wfcmgr and then run (as root) update-menus and hey presto, Citrix ICA manager appears in the Applications/Network menu. Magic!

Thursday, March 25, 2010

SafetyNet5 SNMP variables

Of interest to no-one but me. Here are the OIDs to get sensor info from the SS5:

What sort of sensor is it?
$ snmpget -c ro -v1 ss5
SNMPv2-SMI::enterprises.14748. = INTEGER: 4
(smoke, according to the MIB - this is a bit wacked)

What's the sensor's label?
$ snmpget -c ro -v1 ss5
SNMPv2-SMI::enterprises.14748. = STRING: "Temp on desk"

What is the sensor's value?
$ snmpget -c ro -v1 ss5
SNMPv2-SMI::enterprises.14748. = INTEGER: 286
Degrees centigrade multiplied by 10 - so 28.6 degrees

Next sensor:
$ snmpget -c ro -v1 ss5
SNMPv2-SMI::enterprises.14748. = INTEGER: 1
Type is humidity - this agrees with the MIB

$ snmpget -c ro -v1 ss5
SNMPv2-SMI::enterprises.14748. = STRING: "Humidity on desk"

$ snmpget -c ro -v1 ss5
SNMPv2-SMI::enterprises.14748. = INTEGER: 446
Percentage multiplied by 10 - so 44.6%

And next sensor:
$ snmpget -c ro -v1 ss5
SNMPv2-SMI::enterprises.14748. = INTEGER: 7
Zoned security? Um, no, it's mains fail

$ snmpget -c ro -v1 ss5
SNMPv2-SMI::enterprises.14748. = STRING: "East Wall Power"

$ snmpget -c ro -v1 ss5
SNMPv2-SMI::enterprises.14748. = INTEGER: 0
0 indicates no alarm - that is, power is on

Full MIB here

Monday, March 22, 2010

Making circles in Gimp

Sometimes, I take screenshots, and I like to circle relevant bits of info. The screenshot is easy, using ksnapshot, save it as a PNG file, then open it in Gimp. That's where the fun starts - how do you make a circle (or ellipse) in Gimp?

The answer is: make a new layer, select that layer, on it make an elliptical selection, then fill the ellipse with whatever colour you want to make the line. Then shrink the selection (by, say, 3px) then cut, to remove the centre of the selection. Hey pesto! A neat elliptical line.

Tuesday, March 9, 2010

tcpdump example

Between uses, I generally forget how to do this.

tcpdump -i vr0 udp port 500 and host foo.example.com

-i to select the network interface
udp port 500 is kinda self-explanatory
host foo.example.com - just traffic where foo.example.com is dst or src

Wednesday, March 3, 2010

Firefox on Kubuntu, and opening files

Yeesh, using Firefox on Kubuntu sucks almost as much as not using Firefox on Kubuntu. It's a nice browser, but I download a file, then in the download list, I try to open it, and it says "Oh, what would I open a PDF file with?" and you have to walk through finding acoread, and saying "Use this, and please remember for next time". Then you download another file type - maybe a Word doc - and you get to repeat the whole process for that file type, and so on till you could scream! Then Firefox would probably ask "And what should I use to open a .scream file?"

It's not Firefox's fault, really - there seems to be no uniform way to do this across desktop environments - witness the havoc that ensues when otherwise intelligent people start discussing this issue.

Anyway, buried waaaay down on that page is a suggestion to use xdg-open - essentially a tool that uses your desktop manager's native preferences to decide how to open a file. It's not a perfect solution, but by golly it works! For a minimal config, just use xdg-open to open the containing folder, then rely on your native file manager to provide app preferences for opening the contained files.

VirtualBox, cloning machines, eth0 gone!

I decided to start using virtual machines for my testing. VirtualBox OSE (VB for short) is included with Kubuntu, and so long as I use the version that comes with 9.10 it will work for an Ubuntu 8.04 guest (the version of VirtualBox included with Kubuntu 8.04 lacks the PAE emulation, which an 8.04 guest requires).

Aaaaaanyway, having set up an Ubuntu 8.04 server "vanilla" machine, I've cloned it (well, used the VB GUI to export the appliance, then imported it as a new one). Everything works well, and VB even remembers to assign a new MAC address to the new machines, except... when the new machine boots, there's no eth0.

Turns out Debian (and its derivatives) use udev rules to map the MAC address of a network card to its device name. So my new machine boots (with a new MAC as supplied by VB) and the udev rules that would then automagically map the MAC address to the eth0 device no longer work, and... no eth0.

There's an easy solution for Debian etch, documented in about four-kazillion places on the internet, for example here. Sadly, the udev rule file that writes the rule (eh?) to map MAC to device is more primitive on Ubuntu 8.04, so that's not going to work.

Now for the good news: there's an even simpler way to achieve this, as documented here: simply delete /etc/udev/rules.d/70-persistent-net.rules and reboot. Problem solved!