Open Arena rcon via shell

If you have a dedicated server set up for Open Arena, you can control it either using the command console and rcon on the client side – or by typing in the commands directly into the server process (oa_ded).
But how is it possible to access the server from within a different script or application, or if the server process is not bound to a shell?

First of all, install netcat if you don't happen to have it already on your system.
The trick now is to prefix every command by four non-breaking spaces (255). Thus it's recommendable to write a small shell script for that:

#!/bin/bash
echo $'\377'$'\377'$'\377'$'\377'"rcon $2 $3" | nc -uw0 $1 27960

You can now easily control the server directly from the command line:

chmod +x rcon.sh
./rcon.sh 127.0.0.1 myRconPassword "say Hello"
Hello

Of course it's not only possible to send some texts but – for example – to also change the current map or to set some variables. This allows for easy scripting of the server.

Comments (0)

Leave a comment, if you want to!
Marked fields (*) are mandatory.

Will not be published
By ticking this checkbox you agree to the storage of your data by this website. In order to be able to display comments this website stores the specified name, e-mail address, the specified website, the comment text as well as the time stamp. If you wish, you can have your comments deleted later. For detailed information, see my privacy policy.