Automatic Updates for NS2
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist-x86
dist
src
.gitignore
README
build.cmd
build_x86.cmd
console.spec
env.cmd.sample

README

NS2Update
by: Brian "devicenull" Rak

This tool will automatically keep a NS2 server update to date.  It will query for an update every 5 minutes, and if one is found will kill the server and start SteamCmd.  Earlier versions of this tool had additional functionality, however many of those features were integrated into NS2.

FEATURES:
* Automatic updates
* Automatic restart on crash

INSTALLATION:
1) Take ns2update.exe from the appropriate dist directory (for 64bit OS, use dist/, for 32bit OS use dist-x86/) and copy it to your server directory
2) Run ns2update.exe manually once.  This will generate ns2update.ini, which you need to edit to configure steamcmd. Note that you should not replace server_directory or server_args, these are only used internally and will be overwritten.
3) In whatever script you use to start the server, replace 'Server.exe' with 'ns2update.exe'. (If you don't use a script, just start ns2update.exe instead of Server.exe)
4) (not required) Apply this registry tweak so memory read errors don't hang the server: http://www.zhacks.com/2010/04/10/disable-application-error-memory-could-not-be-read-popup/ .  If you choose not to apply this, it's possible for your server to crash and not be automatically updated.

Once the tool is running, it will automatically start your server up, then check for updates every 5 minutes.  It will check that the server is still running every 5 seconds, and restart it if it has crashed.

CONFIGURATION:
All configuration options are now stored in ns2update.ini.  See below for what they do

* noUpdateCheck
If this is set to true, ns2update will only make sure the server stays running.  It will not attempt to automatically update the server

* steamcmd_binary
This needs to be set to the full path to steamcmd.exe

* steamcmd_user
You need to create a new Steam account for your server to use.  This account does *not* need to have a valid NS2 cdkey, and should *not* be the same as your normal account.  If you use your normal account here, you will get kicked off steam every 5 minutes when update checks happen

* steamcmd_password
This should be the plain text password for your server's steam account.  I know, plaintext sucks here, but you're not using your normal steam account, right?

* steamcmd_appid
This is the appid that should be kept up to date.  For NS2, this is 4940.  If you're trying to sue this for another game, you'll have to look this up yourself (Valve's wiki would be a good place to start)

* server_directory, server_args
NS2Update uses these internally to keep track of what arguments the server should have.  If you change these, they will be overwritten on the next restart.  server_directory gets set to the current working directory.  server_args gets set to whatever arugments you pass on the command line

* server_binary
This should be 'server.exe' for NS2.  This needs to be the actual exe to launch the server, updates will break if you make this a batch file instead.

BUILD NOTES:
* You need the following installed to build:
** PyWin32
** PyInstaller (for generating exe files)
* You can use the console.spec file provided (though you need to update the paths in it!), or generate your own (see PyInstaller documentation)

To use the provided build scripts, copy env.cmd.sample to env.cmd and update the paths in it.  They should point at your x64 and x86 installs of Python (You need to install all the dependencies twice, once for each architecture)