Just to put another solution out there. I don't like the idea of waiting 30 seconds for x to start. It's hackish and assumes that X will start in 30 seconds. I use gdm3 and have daemon.conf set to automatically log in the bitcoin user. Then in /home/bitcoin/.gnomerc, you can have all your miner start code, not having to care about $DISPLAY or whether X has launched properly. Further, this doesn't require creating a custom init.d script.
I think this could be adjusted further by taking out gnome entirely and having a line like:
@reboot startx
in a user crontab then using a .xinitrc to launch things.
Hi martok,
When I originally wrote the upstart script I was in a hurry and wanted to get my rig mining up as soon as possible. I still plan on rewriting the btcminer scripts to take out the sleep 30 and search for X running. I new it was hackish at the time but in bitcoin time is money.

That would also speed up the process but I have not had the time to do that yet. One advantage of running X straight without runing gdm is that all the extra process that are associated with Gnome and GDM are not running. On the latest systems I set up I build them with the mini.iso ubuntu image without even loading a desktop. The only thing I installed was xorg and the utilities to build the ati driver and other software like python.
Here is the original post I wrote for headless mining.
http://forum.bitcoin.org/index.php?topic=9239.0- Dukejer
Extra Bitcoins burning a hole in your pocket? Send them to 19oQLN2v1auiGqBDFfxSDUfu8Ax6ooT6xs if you feel my posts help you.