Skip to content

gsemia/NS2Update

 
 

Repository files navigation

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 HldsUpdateTool

FEATURES:
* Automatic updates
* Automatic restart on crash
* Server logs archived
* Performance graphs (cpu, memory, tickrate, players)
* Server remote control (view server log, players, chat remotely.  Send rcon commands and see the server's response)

INSTALLATION:
1) Grab all the files from your dist/ directory, and upload them to your server (they should go in the same directory as your existing Server.exe binary).  If you are not on a 64bit OS, you should get the 32bit build of ns2update.exe from the dist-x86 directory (rrdtool is already 32bit).
2) 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)
3) (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.

Every 5 minutes the cpu/memory/tickrate/players will be recorded and a graph generated.  This graph will be saved to ns2server.png in the same directory as Server.exe.  NOTE: tickrate will only be recorded if you are running NS2GmOvermind.  The stock server does not have any way to retrieve this information.

CONFIGURATION:
The tool will check the server directory and it's parent directory for hldsupdatetool.exe.  If you have it somewhere else, create a ns2update.cfg file in your server directory.  Put the full path (include hldsupdatetool.exe) to the update tool on the first line.

This tool can optionally restart your server when it goes from full -> empty (Useful due to the resource leaks in NS2).  To enable this, add "--restartwhenempty" to your command line.  Note that if you are running the server on something other then the default IP/port, you must set the IP and port using the "-ip X.X.X.X -port 27016" command line arguments in order to make use of this feature.

If you wish to make use of the web interface, you need to enable web administration (see NS2's 'Dedicated Server Usage.txt' for info).  NS2Update will create itself a user when it starts up (a new password will be chosen on each restart).  Once you have enabled this, you need to add another user (for yourself!).  Once you have added the user, you can log into the ns2update webui with your rcon username/password.  Guest users will only be able to see the active player list.

The web interface will bind to your 'webadminDomain' IP, with the port being one higher then 'webadminPort'.

BUILD NOTES:
* If you are using CherryPY 3.2 and wish to produce a binary using PyInstaller, you must apply the diff in diffs/ to the _cpcompat.py file.  This is due to a bug in PyInstaller.
* You need the following installed to build:
** BeautifulSoup 4
** CherryPy 3.2
** PSUtil
** PyWin32
* You should use the console.spec file provided (though you need to update the paths in it!), or generate your own and make sure you add "hookspath=['C:\\Source\\NS2Update\\hooks']" to the Analysis constructor

WINDOWS BUILD NOTES
If you wish to build Ns2Update on Windows, you have to do the following steps:

64 Bit Windows:
* install python 64 bit to c:\python27
* install pip (http://pypi.python.org/pypi/pip) (Note from Version 1.1 (2012-02-16): Pip uses a special Installation strategy for 64 bit Python)
* install Dependencies:
** run command: c:\python27\Scripts\pip install beautifulsoup4
** run command: c:\python27\Scripts\pip install cherrypy
** run command: c:\python27\Scripts\pip install psutil
** download PyWin32 from http://sourceforge.net/projects/pywin32/
** install PYWin32 using the installer.
* install PyInstaller (http://www.pyinstaller.org/)
** Download the zip file
** unpack the pyinstaller-1.5.1 folder to the NS2Update folder. You should not have a pyinstaller-1.5.1 subfolder in your NS2Update folder.
** run command: python pyinstaller-1.5.1\Configure.py
* create a file called env.cmd in your NS2Update Folder
** and set the following content according to your environment: 

	set python27_64="c:\python27\python.exe"

	set ns2updatedeploypath=\\escher\d$\server\ns2

* Update the console.spec with your environment path
* Apply the diff mentioned above in the BUILD NOTES. (Not tested with pip. perhaps you have to use the manual install method to do that correctly)

you are now ready to use the 64 bit environment.
* use build.cmd to build the dist/ns2update.exe
* use deploy.cmd to deploy the previously built exe file to a configured destination
* use builddeploy.cmd to do both :)

32 Bit Windows AND 64 Bit Windows Environment in one:
* Do all Steps mentioned in the 64 Bit Windows Section
* Install python 32 bit to c:\python27-x86
* install pip 32 Bit (http://pypi.python.org/pypi/pip) (Installer)
** run command: c:\python27-x86\Scripts\pip install beautifulsoup4
** run command: c:\python27-x86\Scripts\pip install cherrypy
** run command: c:\python27-x86\Scripts\pip install psutil
** download PyWin32 32 bit version from http://sourceforge.net/projects/pywin32/
** install PYWin32 32 bit version using the installer.

* make a copy of the already existing pyinstaller-1.5.1 folder from the 64 bit installation and name it pyinstaller-1.5.1-x86
** run command: python27-x86/python.exe pyinstaller-1.5.1-x86/Configure.py
* update the env.cmd file and add the following line:

	set python27_32="c:\python27-x86\python.exe"


you are now ready to use the 32 bit environment.
* use build-x86.cmd to build the dist-x86/ns2update.exe
* there is currently no x86 deploy script available.

About

Automatic Updates for NS2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 51.0%
  • Python 48.4%
  • Shell 0.6%