Category Archives: Linux

RabbitMQ and Upstart

A project I’m working on needs long running processes and I’m managing them with Upstart. It’s a fantastic tool and I can’t rave about it enough. It greatly simplifies the process of turning a script into a service.

One service depends on the RabbitMQ messaging queue server being up and running. Unfortunately, RabbitMQ uses SysV to manage the service rather than Upstart and it can be tricky to get the two to cooperate when one depends on the other. The common way to approach the problem is to remove the symlinks to the RabbitMQ SysV script from the rcX.d directories and use a custom upstart script for RabbitMQ. That solution is less than ideal because I want to leave RabbitMQ alone so I don’t cut off my upgrade path in the future.

I did some poking in the SysV file for RabbitMQ (/etc/init.d/rabbitmq-server) and found out that they already emit signals for service actions! So if I needed an upstart job to start and stop with RabbitMQ, all I have to do is this:

start on rabbitmq-server-running
stop on rabbitmq-server-stopped

Now I’m hoping that RabbitMQ eventually starts packaging an upstart script with their Debian package. Should they do that, I’d probably want to fall back to that for triggering my service. To do so, I only have to tweak things a bit:

start on (rabbitmq-server-running or started rabbitmq-server)
stop on (rabbitmq-server-stopped or stopping rabbitmq-server)

Using the signals emitted by the SysV script isn’t a perfect solution, and I’ll probably want to tweak things a bit to make sure the service is up (maybe in a pre-start exec call?). It also doesn’t emit a signal for any actions other than start and stop (including restart).

But for my purposes, this is pretty good.

Say Hello to Meme Indicator

I use Ubuntu full time on all my computers, as you probably know if you read my infrequent posts here or have been unlucky enough to get caught in a conversation about computers with me.

I really like Ubuntu, 1 so naturally I want it to do well. Which will never happen until there’s a more robust ecosystem of user-oriented programs.

I have neither the time nor the skill to really make a dent in that problem, but I did recently put up my first desktop program for Ubuntu on a Launchpad-hosted PPA 2. It’s just a little something to make it easier for me to do something I very much enjoy: use unicode emoticons 3 in text.

meme-indicator-screenshot-2So I built a python application that adds to the system tray an icon with a dropdown menu of text items. Click an item and it’s copied to your clipboard.

It also has a preferences menu where the user can add, edit, or remove any item from the text snippets. Maybe you don’t know people who would provoke a ಠ_ಠ or maybe you never want to (╯°□°)╯︵ ┻━┻. That’s fine. You could add something you find yourself typing occasionally that you wish you could have in your clipboard 4.

Can’t decide what text to put in there? Why not (/) (°,,,°) (/)?

Anyway, if you want to install the program in Ubuntu, add my ppa to your software sources list:

sudo add-apt-repository ppa:johnpbloch/meme-indicator

And then simply install the package, either through the software center or on the command line:

sudo apt-get update
sudo apt-get install meme-indicator

Notes:

  1. Yes, even Unity
  2. Personal Package Archive
  3. ಠ_ಠ
    (╯°□°)╯︵ ┻━┻
  4. I don’t, know, maybe a terminal command? Or a URL you need to type a lot in messages? There are probably things you could use it for

Netflix on Ubuntu Natively

I’ve written before on how to watch Netflix on Ubuntu, but that still required a VM running Windows 1. Not ideal.

Well now you can run Netflix as a native app. It appears to run on top of Wine and a modded copy of Firefox. Anyway, here’s the video tutorial I used:

This was on Ubuntu 12.10, but that PPA has packages for Precise and Raring too.

Notes:

  1. free copy of Windows, but Windows nonetheless

How to watch Netflix instant on Ubuntu

UPDATE 2012-12-09
I wrote a new post on a better way to do this. I’m going to leave this up because it’s still a good resource on getting a copy of Windows running for IE testing and the like.

…or any Linux distro, for that matter, 100% legally (i.e. no cracked copies of anything, no drm cracking, etc.).

Go here and follow the instructions to install just IE9: (the command I used was

curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="9" bash

)

At home (where I had an average dl speed of 340Kb/s) this took 4 hours. It was something like 10 minutes at work where I was downloading at 4Mb/s.

The VM will expire in 30 days, but you can easily reset to a clean snapshot of the VM from before its deactivation counter started. It comes with Firefox already installed, so you don’t even have to install a new browser!

One thing to watch out for: by default there are no audio drivers installed. In VitualBox, open up the audio options for the VM and turn audio on, then select the correct drivers and hardware. For me, this was the ALSA drivers and the Intel HD hardware. You’ll just have to figure this one out by trial and error.

To do so, change the audio settings, start the VM, and see if windows automatically finds and installs the drivers for audio. If it doesn’t, close and keep trying different combinations until it does. Once the VM has the drivers installed, you need to make sure the audio works well 1. Just go to youtube and play any video. If the sound quality isn’t where you’d want it to be for watching a whole movie or tv show, repeat the previous steps until you find a combination that gives you the desired results.

And now we have oh so sweet Netflix instant on Ubuntu without needing to give Windows the two partitions it demands of our hard drives.

Notes:

  1. Nobody wants to watch Doctor Who with choppy sound!

The Last Days of Distro…

… maybe?

I’ve been getting significantly frustrated with Ubuntu since upgrading to 11.10. It seems to be getting too bloated for my needs. What’s more frightening is that it’s starting to do too much without my input and (sometimes) against my wishes.

The things I’m talking about are very minor and I’ll get into them below, but the direction is what’s worrying.

Continue reading