UGCC's Smart PID Search feature

Post Reply
Site Admin
Posts: 3581
Joined: Thu Apr 20, 2006 2:54 pm
Location: America's Heartland

UGCC's Smart PID Search feature

Post by Masher »

One of the down sides of using UGCC is that the panel needs to have a process ID (PID) of a server to be able to work correctly. This means launching servers via a script (.bat/.sh) has been discouraged, as the panel would track the PID of the shell process that launches the script and not the actual game server that is ultimately launched. To make matters worse, if the script's PID would exit, the panel would think the server was dead and start another instance!

While versions of UGCC prior to 2.50 had ways of coping with this (PID files, etc.); it was problematic and error prone. In version 2.50 we added a new feature called Smart PID Search. It allows the panel to find these types of PIDs without much effort required from you and no longer requires pid files! A new field (Smart PID Search) was added to each server's executable tab to utilize this feature.

The Smart PID Search option will iterate through all the processes running on a node, and match the strings specified in the Smart PID Search setting to make a match. Once a match is made the panel will track this particular PID. The strings that it searches for must only match one process, otherwise the feature will not work and will be unreliable.

It's probably best to explain with an example. We have a server that is launched via a utility program (this could also be a .bat or a .sh file; it really doesn't matter). The panel launches:

Code: Select all

Server executable = C:\Program Files (x86)\ForceBindIP\ForceBindIP.exe

Command line arguments = %Root%\srcds.exe -console -game cstrike -condebug -port 27040 +ip %IP% +maxplayers %MaxPlayers% +sv_setsteamaccount %Var1% +clientport %Port-10% +tv_port %Port+5% -strictportbind +map de_dust2 +rcon_password "mysupersweetrconpassword"

Smart PID Search = exe=srcds,-port 27040,+ip %IP%
Here the panel would launch ForceBindIP.exe. ForceBindIP would then launch srcds.exe. ForceBindIP closes once it launches srcds.exe. Without Smart PID Search the panel would assume the server died if monitoring is enabled since it exited and would then relaunch the server. Since this particular example is using Windows there is no easy way to generate a PID file.

Since we specified a Smart PID Search setting for this server the panel would look at all running processes on the server to find the correct PID to track. Also variables may be used in the Smart PID Search setting.

Strings that have to match in running processes should be separated by commas. Each item separated by commas must match EXACTLY and all be present to be successful.

A special function is exe=<name of process>, on Windows this will filter the list of processes the panel has to process and greatly speeds up the search. While it's not necessarily needed on Linux, it too will help ensure a successful match. The <name of process> would typically be the executable's name without a path or extension on Windows. On Linux you may have to experiment and find the name of the process via the ps tool.

The panel will then check the arguments used to launch that process and if all items are matched, and the panel isn't already tracking that PID; the panel will use that PID for the new process within the panel.

If the panel finds no matches, it will sleep for 250Ms and retry up to 10 times.

If more than one match is found the panel will not use any found PIDs, but will continue to check every 250Ms up to 10 times. If more than one match is found after this time period you should try to use more restrictive search strings.

Reviewing the logs will be helpful in determining what is happening if the panel can't find the PID.

Good examples of search strings would include
-Port and IP combinations: these will generally be unique per server
-Server Keys
-Any unique argument (id, server keys, etc, paths if used)
-Rcon passwords (just don't change them!)
Please do not PM me unless asked to! We are a small company. If you have an issue or question it would be best to post it in the forums where it can help others in the future.

NEW Join our Discord!
Post Reply