Server Control

From BZFlagWiki
Jump to: navigation, search

Plugin Description[edit]

This plugin takes a single command line argument that specifies the filename for the plugin configuration file.

An example configuration file is provided in 'plugins.cfg' found in the plugin's source directory.

Example Configuration File[edit]

# Plugin Configuration File

# serverControl plugin options
#   All values are optional.  You can omit values by commenting them
#   out of leaving them with no value defined as in 'key ='


 # Ban File Section
 # ----------------
 # Ban files can be shared between multiple servers.
 # Specify the location for the shared banfile.
 # The plugin checks the modification time for the file
 # every tick event (approximately every 3 seconds) and
 # reloads the banfile information on the server

 # Ban file location
 BanFile = db/banfile
 # Message to display when bans are reloaded.
 BanReloadMessage = Bans updated

 # Local file copy of the master ban
 MasterBanFile = db/master-bans.txt
 # Message to display when the master ban list is reloaded
 MasterBanReloadMessage = Master bans updated

 # Server Restart Section
 # ----------------------
 # If you run your BZFlag server in a server loop from a shell script
 # you can force the server to exit so the server can be reloaded by
 # the controlling shell script.
 # The plugin causes the server to shutdown if the server was active
 # and has zero players.  A server is considered active if at least
 # one non-observer player has connected to the server.  This can be
 # used to change maps, reset the server back to its default
 # settings, etc.

 # The ResetServerOnceFile normally does not exist.  You create this
 # file when you want to force a server reset.  You can do this on
 # busy maps to queue a server shutdown when the game ends without
 # interrupting play.  If this file exists and the server is empty it
 # forces an immediate shutdown regardless of whether the server was
 # active or not.  You would normally use this when you update to a
 # new version of the server or plugin code or change server
 # configuration options and want to restart the server without
 # interrupting any currently running games.  The ResetServerOnceFile
 # is removed when the server is shutdown by the plugin.
 ResetServerOnceFile = reset-server-once

 # If the ResetServerAlwaysFile exists the server will exit each time
 # the last player leaves the server.  The server requires a
 # non-observer to join to put it in an 'active' state before the
 # plugin will cause the server to exit (someone actually has to use
 # the map before the server exits). This can be used to control
 # rotation servers with no time limit.
 ResetServerAlwaysFile = reset-server-always

 # Ignore observers makes the server shutdown after a non-observer has
 # connected even if observers are still present
 #IgnoreObservers = true

The purpose of this plugin is for ban file synchronization across multiple BZFlag servers running on the same host and for controlled server shutdown for queued server restarts. The plugin will reload the ban file or master ban file entries when it notices a modification to the local file.

To use this effectively with the BZFlag masterban file you should copy the banfile from the official server to a local file and only modify the local master ban file the plugin looks at if the contents of the ban file changes.

This plugin can also shut down the BZFlag server on demand or everytime a game ends.

An example script (for Linux systems) to keep a local copy of the masterban file is displayed below:

Master Ban Update Script[edit]

while true; do
  #Run forever every 10 minutes.
  `wget -O $BANFILE`
  sleep 600

Plugin Loading[edit]

Plugin loading format:

 -loadplugin /path/to/serverControl,/path/to/plugins.cfg