McMyAdmin as Daemon on Linux

I’m pretty sure that by now, everyone reading this blog has heard of or probably
even played Minecraft himself. It’s a sweet little game
that tosses you into a simplified world that you can freely (and easily!) shape
in any way you want. Your tasks: feed yourself, keep monsters out of your buildings
and build something remarkable.

Minecraft can, of course, be played with any number of players online. All you need
is a server with shell access and Java on it. If you also have Mono on your server,
you can use McMyAdmin, a very convenient web frontend for
the Minecraft server to manage users and perform automated backups.

Now if you’re running a server for longer than just an evening game, you’d probably
want it to keep running even when you log off. This can be accomplished via the
GNU Screen utility which runs
a process in a virtual console and can keep it running even when the user that
launched it logs off.

As any self-conscious server administrator would want to do, you of course want your
Minecraft server to run as a daemon so it can be scheduled to automatically quit
when the system is shut down and start again when the system boots up. What you want
is an init script!

Gentoo

I have found some init scripts for a pure Minecraft server, but not many for McMyAdmin,
so I had to write one myself. I’m running Gentoo Linux,
the only good Linux distribution there is, so obviously this init script is meant for
that distribution as well:

Paste this as /etc/init.d/mcmyadmin and make it runnable
(chmod +x /etc/init.d/mcmyadmin), then you can start and stop your McMyAdmin-based
server like any other system service.

If you’re new to screen, in order to view the console output of McMyAdmin, just enter
screen -r to connect to the virtual screen console. To put it back in the background,
press Ctrl+A,D (or enter /quit to terminate McMyAdmin).

Debian

Debian users should download the Gentoo Live CD, boot up and follow
the Installation Guide in the Gentoo Linux Handbook. Oh well, if you
really must, you could of course also install those 3 years old Mono packages, revel in
having half of the X windows system on your headless server and use this init script instead:

If its init system is Debian-inspired it will probably work. I think it might ignore the comments-turned-instructions at the very top of the script and not execute in the right order if added to a runlevel.