Automatic Updates
devicenull
Join Date: 2003-04-30 Member: 15967Members, NS2 Playtester, Squad Five Blue
<div class="IPBDescription">For your server</div>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. It also provides an optional web UI, where you can view your server's log, execute rcon commands, and view player information.
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).
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: <a href="http://www.zhacks.com/2010/04/10/disable-application-error-memory-could-not-be-read-popup/" target="_blank">http://www.zhacks.com/2010/04/10/disable-a...-be-read-popup/</a> . 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'.
BUGS:
If you experience any issues, please <b>open a bug on GitHub</b>. Sending me forum PMs is less then ideal, as the forum PM interface is about 75% broken and not open to the public!
Some screenshots:
This is the public interface, anyone with the URL can view it:
<img src="http://dl.dropbox.com/u/2078961/ns2update/public.png" border="0" class="linked-image" />
Here, you can view your server's console (in real time), as well as execute rcon commands:
<img src="http://dl.dropbox.com/u/2078961/ns2update/console.png" border="0" class="linked-image" />
You can also view all the chat that's happening on the server, though responding is not yet possible (NS2 doesn't currently have a 'say' rcon command):
<img src="http://dl.dropbox.com/u/2078961/ns2update/chat.png" border="0" class="linked-image" />
You can get the binary and source code at <a href="https://github.com/devicenull/NS2Update" target="_blank">https://github.com/devicenull/NS2Update</a> . See the Downloads button in the top right if you want a zip or tar.gz .
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).
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: <a href="http://www.zhacks.com/2010/04/10/disable-application-error-memory-could-not-be-read-popup/" target="_blank">http://www.zhacks.com/2010/04/10/disable-a...-be-read-popup/</a> . 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'.
BUGS:
If you experience any issues, please <b>open a bug on GitHub</b>. Sending me forum PMs is less then ideal, as the forum PM interface is about 75% broken and not open to the public!
Some screenshots:
This is the public interface, anyone with the URL can view it:
<img src="http://dl.dropbox.com/u/2078961/ns2update/public.png" border="0" class="linked-image" />
Here, you can view your server's console (in real time), as well as execute rcon commands:
<img src="http://dl.dropbox.com/u/2078961/ns2update/console.png" border="0" class="linked-image" />
You can also view all the chat that's happening on the server, though responding is not yet possible (NS2 doesn't currently have a 'say' rcon command):
<img src="http://dl.dropbox.com/u/2078961/ns2update/chat.png" border="0" class="linked-image" />
You can get the binary and source code at <a href="https://github.com/devicenull/NS2Update" target="_blank">https://github.com/devicenull/NS2Update</a> . See the Downloads button in the top right if you want a zip or tar.gz .
Comments
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->[NS2Update] DEBUG Command line args:
[NS2Update] DEBUG Checking for server update...
[NS2Update] DEBUG Setting update check delay to 300
[NS2Update] INFO Server is out of date: current: 0 desired: 18
[NS2Update] INFO Starting server update
Traceback (most recent call last):
File "ns2update.py", line 108, in <module>
File "ns2update.py", line 34, in update
File "subprocess.pyc", line 672, in __init__
File "subprocess.pyc", line 882, in _execute_child
WindowsError: [Error 2] The system cannot find the file specified<!--c2--></div><!--ec2-->
Is this something to do with permissions, environment path, or a problem with python? Any help would be appreciated.
EDIT: It's worth mentioning the server is up-to-date.
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->[NS2Update] DEBUG Command line args:
[NS2Update] DEBUG Checking for server update...
[NS2Update] DEBUG Setting update check delay to 300
[NS2Update] INFO Server is out of date: current: 0 desired: 18
[NS2Update] INFO Starting server update
Traceback (most recent call last):
File "ns2update.py", line 108, in <module>
File "ns2update.py", line 34, in update
File "subprocess.pyc", line 672, in __init__
File "subprocess.pyc", line 882, in _execute_child
WindowsError: [Error 2] The system cannot find the file specified<!--c2--></div><!--ec2-->
Is this something to do with permissions, environment path, or a problem with python? Any help would be appreciated.
EDIT: It's worth mentioning the server is up-to-date.<!--QuoteEnd--></div><!--QuoteEEnd-->
The tool is currently set up so that it assumes hldsupdatetool is one directory below the server.exe. The error you are getting basically means it can't find hldsupdatetool, because it's not where it was expected. I'll add some code to look for hldsupdatetool in the current directory, but for the moment you can simply copy it one directory above your Server.exe file.
In your readme where it says to make an cfg file and point it to hltools... Uh what command lines do that? :)
I know how to make the cfg file, but not sure what command it is to point to the correct location of the tools.exe file in program files\valve.\etc...
In your readme where it says to make an cfg file and point it to hltools... Uh what command lines do that? :)
I know how to make the cfg file, but not sure what command it is to point to the correct location of the tools.exe file in program files\valve.\etc...<!--QuoteEnd--></div><!--QuoteEEnd-->
You would put this in the config file:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->C:\Program Files\Valve\HldsUpdateTool.exe<!--c2--></div><!--ec2-->
Adjust the path as needed of course.
and running server.exe
I have copied over dist64 into my current server directory; example -
C:\NS2Server\dist64
In C:\NS2Server I have created that .cfg file and will put in that command above (when I get home :P) to point to my hldsupdatetools.exe.
Do I leave that .cfg file in the main directory or copy it to the dist64 directoy?
Is the .exe in your dist64 directory automatically try to find this .cfg file?
(sorry at work at the moment so cannot try it yet)
Also last night I copied the hldsupdatetools.exe into my server directy and ran your .exe in the dist64 directory, but it started to install all the server files again? I just cancelled it.
Thank you for your help :)
CRITICAL unable to find hldsupdatetool.exe
after it says that it has found the cfg file
the path is correct C:\Program Files (x86)\Valve\HLServer\hldsupdatetools.exe
:(
CRITICAL unable to find hldsupdatetool.exe
after it says that it has found the cfg file
the path is correct C:\Program Files (x86)\Valve\HLServer\hldsupdatetools.exe
:(<!--QuoteEnd--></div><!--QuoteEEnd-->
Can you paste me the entire output of the program? You can find it in the ns2update.log file.
If it helps in the mean time, I remember it saying in the logs, first the time, then saying it has found the ns2update.cfg file, then it says it will now be locating hldsupdatetools.exe
then on the next line it says CRITICAL unable to find hldsupdatetools.exe, please find the path (or something) or copy it into your server directory.
I've tried putting the folder path in " " and also renaming hldsupdatetools to exact capital letters.. Hmm but still no luck :(
Anyway if that's no help, I'll copy it all in when I get home. Cheers.
05-23 18:45 root DEBUG Command line args:
05-23 18:45 root DEBUG Found ns2update.cfg file, loading hldsupdatetool path
05-23 18:45 root CRITICAL Unable to find hldsupdatetool.exe, please copy to server directory or see README
in my config file -
C:\Program Files (x86)\Valve\HLServer\HldsUpdateTool.exe
I'm trying to use it with wine but I've some errors.
05-23 18:45 root DEBUG Command line args:
05-23 18:45 root DEBUG Found ns2update.cfg file, loading hldsupdatetool path
05-23 18:45 root CRITICAL Unable to find hldsupdatetool.exe, please copy to server directory or see README
in my config file -
C:\Program Files (x86)\Valve\HLServer\HldsUpdateTool.exe<!--QuoteEnd--></div><!--QuoteEEnd-->
I've just released an update to fix this. The configuration file was actually being ignored.
<!--quoteo(post=1848174:date=May 24 2011, 10:37 AM:name=vlnc)--><div class='quotetop'>QUOTE (vlnc @ May 24 2011, 10:37 AM) <a href="index.php?act=findpost&pid=1848174"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Does your automatic updates only works with Windows ?
I'm trying to use it with wine but I've some errors.<!--QuoteEnd--></div><!--QuoteEEnd-->
I have not tested it in wine, nor do I have any plans to. As it's written in python, you can run it natively with very minimal changes. I'm not going to be releasing a version that works in linux until the server has a native port. If you want to try it yourself, I believe these to be the only two lines you would need to change:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->paths = [ "../hldsupdatetool.exe", "hldsupdatetool.exe" ]<!--c2--></div><!--ec2-->
and
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->self.serverProc = subprocess.Popen("Server.exe %s" % self.serverArgs, stdin=None, stdout=subprocess.PIPE)<!--c2--></div><!--ec2-->
Cheers :)
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->paths = [ "../hldsupdatetool.exe", "hldsupdatetool.exe" ]<!--c2--></div><!--ec2-->
and
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->self.serverProc = subprocess.Popen("Server.exe %s" % self.serverArgs, stdin=None, stdout=subprocess.PIPE)<!--c2--></div><!--ec2--><!--QuoteEnd--></div><!--QuoteEEnd-->
Ok thanks, I'll try to change that.
The activation context creation failed pour « C:\ns2server\ns2update.exe ». Assembly dépendant Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" introuvable. Utilisez sxstrace.exe pour un diagnostic détaillé.
do I need to install visual basic ? what version (9?).
Thank you devicenull
Ok it's works now, just have an errors when i launch my script.
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->06-01 11:50 root DEBUG Logging to 2011.06.01.1150.log
06-01 11:50 root CRITICAL Server has died, restarting!
06-01 11:50 root INFO Server started, pid 948
06-01 11:50 root DEBUG Logging to 2011.06.01.1150.log
06-01 11:50 root CRITICAL Server has died, restarting!
06-01 11:50 root INFO Server started, pid 2052
06-01 11:50 root DEBUG Logging to 2011.06.01.1150.log
06-01 11:50 root CRITICAL Server has died, restarting!<!--c2--></div><!--ec2-->
my script restart :
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->@echo OFF
echo "Kill ns2update.exe"
taskkill /F /IM ns2update.exe
echo "Lancement Serveur"
cd C:\ns2server
ns2update.exe --restartwhenempty -ip 88.190.18.171 -p 27016
REM server.exe -file C:\ns2server\server.xml -game C:\ns2server\NS2GmOvrmind<!--c2--></div><!--ec2-->
here is the log from ns2update.log
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->06-01 11:54 root DEBUG Command line args: --restartwhenempty -ip 88.190.18.171 -p 27016
06-01 11:54 root DEBUG Found ns2update.cfg file, loading hldsupdatetool path
06-01 11:54 root DEBUG Added path from config file: C:\Program Files (x86)\Valve\HLServer\hldsupdatetool.exe
06-01 11:54 root INFO Detected server IP as 88.190.18.171:27017
06-01 11:54 root INFO Server will be automatically restarted when empty
06-01 11:54 root DEBUG Checking for server update...
06-01 11:54 root INFO Server is out of date: current: 0 desired: 18
06-01 11:54 root INFO Performing inital server update
06-01 11:54 root INFO Starting server update
06-01 11:54 root INFO Server update complete!
06-01 11:54 root INFO Server started, pid 1244
06-01 11:54 root DEBUG Logging to 2011.06.01.1154.log
06-01 11:54 root CRITICAL Server has died, restarting!
06-01 11:54 root INFO Server started, pid 2856
06-01 11:54 root DEBUG Logging to 2011.06.01.1154.log<!--c2--></div><!--ec2-->
here is the content of this log :
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->Invalid command line settings.
Invalid command line settings.<!--c2--></div><!--ec2-->