Is there such a thing as too much BZFlag?

BZTips #6 – Hosting Tricks

by blast on 2010-08-13, no comments

Over the years, I’ve done quite a bit of game server hosting for BZFlag. I’ve run an assortment of maps and styles, from old school box and pyramid maps to “high” poly count mesh based maps. In this time, I’ve come up with a few tricks to make running and administering my servers a little easier. I’m no expert at this, however, and there are much cooler/better tricks. But I’ll cover a couple tricks that I use for hosting my servers.

Emailing reports

I have a little script that I use to email reports that people leave on my servers. A report is left on a server by hitting a chat key, typing /report, and then after that the message the user wants to leave. Generally, it is necessary for the admins or owner to join the server and run /viewreports to see what reports have been left. However, with this, reports can be emailed to any email address. You could set up a mailing list for your top admins so that they receive these reports. Here is the script:

read report #we want the second line, which is the actual report
(echo $report | mail -s 'Report from '$1 $2) &

Chmod this to be executable (chmod u+x and make note of where you save this file. To use the script, you will add a reportpipe to your configuration file pointing to this script.

-reportpipe "/path/to/ SingleWordIdentifier"

(Note that it should be a single line… the width of the blog makes it wrap to two lines) The first argument to the script is a short single word identifier. This could be the port number, a short name for the map, or whatever you want. It will appear in the subject line of the email as “Report from SingleWordIdentifier”. The actual report (including who it was from) will appear as the body of the email.

Watching a log in real time

There are times when I get bored, so I check out what’s happening on my server by reading the chat and server messages. I run the logDetail plugin, so I get messages formatted a certain way. I can keep tabs on the current chat messages (and server messages, commands, and reports) by using this command:

tail -f -n 500 log | grep MSG

The tail command is used to read a number of lines from the end of a file or piped output. In the case above, it reads the last 500 lines of the file named ‘log’, and then continues to “follow” the file via the -f option. When it follows the file, it means that it keeps reading any new lines added to the end of the file. All of the output from tail is piped to a grep that looks for the word MSG in all caps, which is what the logDetail plugin will output for chat messages and other types of messages. By doing this, we can read chat and related messages in real time from the *nix shell.

I’ll try to cover some of my hosting layout in a future post.