| Contenu |
|---|
| Miniature aléatoire |
|---|
![]() |
| Rechercher |
|---|
| Login |
|---|
| Navigation |
|---|
| Les plus récents |
|---|
| Articles vedettes |
|---|
| Navigation |
|---|
| Qui est en ligne? |
|---|
| Nous avons 1139 invités en ligne |
| Running applications on server events |
|
| Descent 3 - Outil serveurs dédiés sous Windows pour Descent3 | |
| Écrit par Thomas | |
| Dimanche, 12 Décembre 2010 22:41 | |
|
D3Server3 supports the invocation of external executable files on certain events. This funcionality can for example be used to upload statistics files or perform clean-up tasks. The currently supported events are:
You can run different executable files for different servers or specify a default file for all dedicated servers. The command line provided for the events can contain environment variables. D3Server3 resolves them before the executable file is invoked, if they are enclosed in ''%' characters, like in a command-line script itself. For example, to call a batch file MyBatchFile.cmd on an event, use: "%COMSPEC%" /C MyBatchFile.cmd The environment variable COMSPEC points to the command-line interpreter on normal Windows operating systems (Windows NT, 2000, XP, Vista, 7, servers). The events for invoking the external program are stored in a Windows ini file called 'ServerEvents.ini'. Each section in this file is responsible for a different event. Each key in a section specifies the name of a dedicated server, the UDP port and the name of a dedicated server, where the port and the name are separated by a colon (':'), or a default command line for any server/port. The following example shows what the section [OnServerStart] could look like. This event occurs when a dedicated server is started. The lines are explained below the example.
The section name [OnServerStart] specifies the event the section is for. It occurs when a dedicated Descent 3 server is started. The Default key provides a command line to execute a program for any server. In the above example, the application called is stored in the environment variable COMSPEC, which contains the full path and file name of the Windows command interpreter CMD.EXE. The variable's name is enclosed in double quotation marks in case the path contains space characters. CMD.EXE is given the command-line parameter /C to make it execute the command-line script MyBatchFile.cmd and then exit. The next line calls the batch file MyOtherBatchFile.cmd when the server "This is the server name" runs on port 2099. Note that the server's port is separated by a colon (':') from its name. The batch file MyLastBatchFile.cmd is called independant of the server port, but only if the server "This is the server name" is not running on port 2099, since the events are checked from top to bottom. The Default key is the only exception. It is only processed when no other event for a server could be found.
The working directory (or current directory) is the directory in which D3Server3.exe resides. Since Windows ini files use the square brackets ('[' and ']') for section names, it is currently not possible to specify server names that contain square brackets in their names.
A ServerEvents.ini file can contain a [General] section. Currently only the key ShowWindow in this section is supported. If this key has a value of HIDE, the applications are executed hidden. This can prevent their windows from popping up every time an event occurs. If ShowWindow is not HIDE, the started applications receive the focus on the desktop, which can be quite annoying if you're working on the computer when an event occurs.
The applications are executed one by one, and D3Server3 waits for each one to terminate before the next program is opened. You can only change this behaviour, when the application to execute itself opens another process and then terminates. D3Server3 would not know about the second application. Note that the server tool waits for the application's process to terminate, which is not what most other softwares do. D3Server3 places the applications to execute in a queue every time the appropriate event occurs. The size of this queue is currently limited to 100. This means that D3Server3 will only hold up to 300 waiting application executions. Additional events cannot trigger the programs to be called anymore until previous processes terminate. When D3Server3 terminates, remaining application calls are not processed. D3Server3 tries to process the [OnD3Server3Close} section right after you close the server tool. This section can only have a Default key since this event does not occur for a particular server.
Here's a complete example of a ServerEvents.ini file:
|
|
| Mise à jour le Dimanche, 19 Décembre 2010 16:53 |
You need to login or register to post comments.
Discutez de ceci sur le forum. (0 posts)




