BackgroundTime to put my SysAdmin hat on for a moment to explain how to run the popular Windows IRC log parsing application: mIRCStats on a headless Linux box without an X Server. I found no resources online how to do this despite this being, in my view, a very likely use case. Of course, there are alternative open-source IRC stat generation projects that can accomplish this with ease such as pisg, IRCStats and Denora. I personally prefer the features and layout that mIRCStats generates though having tried the others, therefore I was determined to get this running. :)
This was tested with:
- mIRCStats 1.24
- Debian 7 (Wheezy)
- WINE 1.4.1
- xvfb (X Virtual Frame Buffer) 1.12.4-6
Problems and Fixes
No X Server - No DisplayThe first problem that you will encounter is the fact that the mIRCStats application attempts to spawn its GUI window whenever you try to launch it via WINE, even if it has all the information necessary to process stats via its settings file or command line options. (It is more than a little annoying that it insists on spawning a window just to tell you it's updating the stats, but I guess when borrowing Window software I should expect it to follow typical Windows user conventions.) This will obviously fail as no X Server is running on your box and thus there's no display to draw to:
quoteObviously installing the entire X Server purely for this on the box is highly undesirable. Luckily, it it possible to fool the application into thinking a real display exists by using Xvfb (X Virtual Frame Buffer) to spawn a "display" that performs all graphical operations in memory. This is very handy when we don't care about the actual graphical output and just want the utility to get on with its job and close, which is precisely what mIRCStats does. Go ahead and install that using your preferred method for your distribution. On Debian, Xvfb resides in the stable repository so it's as simple as: apt-get install xvfbdynamite@debian:~/mircstats$ wine mircstats
Application tried to create a window, but no driver could be loaded.
Make sure that your X server is running and that $DISPLAY is set correctly.
Unhandled Page FaultNow you have Xvfb installed, you should be able to use the xvfb-run wrapper script to quickly spawn a mIRCStats session and make it process the logs:
quoteAt least that was the theory. In practice, I encountered the following crash at this point from WINE itself:dynamite@debian:~$ xvfb-run wine /home/dynamite/mircstats/mircstats.exe -l "/home/dynamite/mircstats/*.log" -html "/var/www/services.pwnsu.com/neoseeker.html"
quoteIt seemed to still be having problems spawning the window. It was at this point that I delved into the default mIRCStats Config/settings.cfg file and switched the default starting mode of the application to spawn a tray icon instead of trying to launch a window:wine: Unhandled page fault on read access to 0xfffffffe at address 0x0000:0x7bc4a744 (thread 0009), starting debugger...
Minimized = Tray
For good measure I switched on Automode by default and removed the Countdown to speed the process up a little:
Automode = Yes Countdown = No
With those changes made, the command executed previously should work and your stats should get generated. From there on, a simple crontab entry to generate our stats on an hourly cycle was in order to complete the job:
quoteNote: It is important to enclose the cmdline variables passed to mIRCStats within quotation marks otherwise you may see behavior like the wildcard * not be interpreted correctly.0 * * * * xvfb-run wine /home/dynamite/mircstats/mircstats.exe -l "/home/dynamite/irclogs/pwnsu/*neoseeker*" -html "/var/www/services.pwnsu.com/neoseeker.html" > /dev/null 2>&1
I hope this proves useful for someone looking to do the same. :)
Tiffany di Vita
- ICQ 174984862
- AIM NeoDyno
- Microsoft account email@example.com
- Google Talk firstname.lastname@example.org