Skip to main content

Overview

GamePanelX provides complete lifecycle management for game and voice servers. The server management system handles creation, monitoring, control, and maintenance of game servers across local and remote infrastructure.

Server Control

Start, stop, and restart servers with real-time status monitoring

Automated Updates

Update servers automatically via SteamCMD or custom update commands

Multi-Server Support

Manage multiple servers across different network locations

Resource Monitoring

Track CPU, memory usage, and process information for each server

Core Server Operations

Creating Servers

GamePanelX creates servers through the Servers::create() method, which handles the complete setup process:
  1. Validation - Checks IP/port availability and validates game configuration
  2. User Account Setup - Creates isolated system user accounts (SSO)
  3. Template Deployment - Copies files from the selected game template
  4. Database Entry - Records server configuration and startup parameters
  5. Remote Execution - Runs CreateServer script on target network server
  6. Callback Verification - Confirms successful creation via callback URL
  • netid - Network server ID where the server will be created
  • gameid - Game configuration ID (or template ID)
  • ownerid - User ID who will own the server
  • port - Port number for the server
  • tplid - Template ID (optional, uses default if not specified)
Server Creation Example
// Create a new game server
$Servers = new Servers();
$result = $Servers->create(
    $netid,          // Network ID
    $gameid,         // Game ID
    $ownerid,        // Owner user ID
    $tplid,          // Template ID
    $port,           // Port number
    $description,    // Server description
    $total_slots,    // Max players
    $rcon_password,  // RCON password
    $is_private,     // Privacy setting
    $private_password // Server password
);
GamePanelX automatically validates IP/port combinations to prevent conflicts. Each server gets a unique system user account for security isolation.

Starting and Stopping Servers

Server control is managed through dedicated methods that interface with remote bash scripts:

Restart Operation

The restart function (Servers::restart()) performs a complete server restart:
Restart Server
// Restart a game server
$Servers = new Servers();
$result = $Servers->restart($server_id);

// Returns 'success' or error message
Restart Process:
  1. Retrieves server configuration from database
  2. Updates server config file with current settings
  3. Executes remote Restart script via SSH
  4. Script stops existing process and starts new one

Stop Operation

The stop function (Servers::stop()) gracefully terminates the server:
Stop Server
// Stop a running server
$Servers = new Servers();
$result = $Servers->stop($server_id);
Stop Process:
  1. Locates server process using PID file or port matching
  2. Sends termination signal to process
  3. Verifies process shutdown
  4. Updates status in database
Servers use GNU Screen sessions to run in the background, allowing administrators to attach to the console for debugging.

Updating Servers

GamePanelX supports automated server updates through the Servers::update() method:
Update Server
// Update a game server
$Servers = new Servers();
$result = $Servers->update($server_id);
Update Types:
For Steam-based games, GamePanelX uses SteamCMD:
  • Validates Steam credentials from configuration
  • Passes Steam Guard authentication if configured
  • Executes SteamCMD with game-specific app ID
  • Monitors update progress
  • Sends callback on completion
For non-Steam games:
  • Executes custom update command defined in game configuration
  • Supports HTTP downloads, rsync, or custom scripts
  • Callback URL notifies panel when complete

Deleting Servers

Server deletion is a two-step process:
Delete Server
// Delete a server (removes files and database entry)
$Servers = new Servers();
$result = $Servers->delete($server_id);

// Soft delete (database only)
$result = $Servers->delete_soft($server_id);
Deletion Process:
  1. Executes DeleteServer script on remote server
  2. Removes server directory and files
  3. Removes database entries from servers and servers_startup tables
  4. Optionally preserves system user account

Server Monitoring

Real-Time Status

GamePanelX queries server status through multiple methods:

GameQ Integration

For supported games, GamePanelX uses GameQ v2 for detailed server queries:
Query Server Status
// Query server with GameQ
$Servers = new Servers();
$srv_info = $Servers->getinfo($server_id);
$results = $Servers->query($srv_info);

// Returns player count, map, server name, etc.
If a game doesn’t support GameQ, the system falls back to a basic TCP port check to verify if the server is online.

Process Information

Retrieve CPU and memory usage:
Get CPU/Memory Info
// Get server resource usage
$Servers = new Servers();
$cpu_info = $Servers->getcpuinfo($server_id);

// Returns JSON with PID, CPU%, and memory usage
The CheckGame script on the remote server provides:
  • Process ID (PID)
  • CPU usage percentage
  • Memory consumption (RSS)
  • Process status

Console Output

Access real-time server console output:
Get Server Output
// Get recent console output
$Servers = new Servers();
$output = $Servers->getoutput($server_id);

// Returns last 50 lines of console output
This reads from the GNU Screen session buffer to display recent server logs.

Sending Commands

Send commands to running servers:
Send Console Command
// Send command to server console
$Servers = new Servers();
$result = $Servers->send_screen_cmd($server_id, 'say Hello players!');
Commands are sanitized to prevent shell injection. Characters like ;, &, /, and | are blocked.

Configuration Management

Server Config Updates

GamePanelX automatically updates game configuration files when settings change:
Update Config File
// Update server configuration file
$Servers = new Servers();
$result = $Servers->configupdate($server_id, $srv_info, $net_info);
Config File Support:
Uses key-value pairs with customizable separators:
hostname = My Game Server
maxplayers = 24
rcon_password = secretpass
sv_password = serverpass

Startup Command Management

Each server has a customizable startup command built from parameters:
Update Startup Command
// Rebuild startup command from parameters
$Servers = new Servers();
$result = $Servers->update_startup_cmd($server_id, $srv_ip, $srv_port);
Startup commands support variable replacement:
  • %IP% - Server IP address
  • %PORT% - Server port
  • %MAP% - Default map
  • %MAXPLAYERS% - Maximum players
  • %HOSTNAME% - Server hostname
  • %RCON% - RCON password
  • %PASSWORD% - Server password

Server Migration

Move servers between users or network locations:
Move Server
// Move server to different user or IP
$Servers = new Servers();
$result = $Servers->moveserver(
    $srvid,
    $orig_userid,
    $orig_username,
    $orig_netid,
    $orig_ip,
    $orig_port,
    $new_userid,
    $new_netid,
    $new_port
);
Migration Process:
  1. Validates source and destination parameters
  2. Creates new user account if needed
  3. Executes MoveServerLocal script
  4. Copies server directory to new location
  5. Updates database with new ownership/location

Remote Script Operations

GamePanelX server management relies on remote bash scripts located in _SERVERS/scripts/:
ScriptPurpose
CreateServerCreate new server instance and deploy template
RestartStop and restart server process
StopGracefully stop running server
UpdateServerUpdate server files via Steam or custom command
DeleteServerRemove server files and directories
CheckGameQuery process info (PID, CPU, memory)
ServerOutputRetrieve console output from screen session
ServerSendCMDSend command to server console
MoveServerLocalMove server between users/locations
ConfigUpdateUpdate configuration file remotely
All remote scripts support both local execution (via PHP exec()) and remote execution (via SSH). The Network::runcmd() method automatically chooses the appropriate method.

Best Practices

  • Use descriptive hostnames that identify the server purpose
  • Include game type or community name in descriptions
  • Avoid special characters in server names
  • Monitor server load with getcpuinfo() before creating new servers
  • Distribute servers across network nodes for load balancing
  • Set appropriate max player limits based on available resources
  • Schedule updates during off-peak hours
  • Test updates on development servers first
  • Maintain backup templates before major updates
  • Use strong RCON passwords (auto-generated by default)
  • Isolate servers with individual user accounts
  • Regularly update server software for security patches

Troubleshooting

Server Won’t Start

  1. Check console output with getoutput()
  2. Verify port is not in use
  3. Check file permissions in server directory
  4. Review startup command for syntax errors

Server Status Shows Offline

  1. Verify server process is running with getcpuinfo()
  2. Check if GameQ name is configured correctly
  3. Test TCP connectivity to server port
  4. Review firewall rules on network server

Updates Failing

  1. Verify Steam credentials in configuration (for Steam games)
  2. Check disk space on network server
  3. Review update command syntax in game configuration
  4. Check callback URL is accessible from network server
Server logs are stored on the network server at $HOME/logs/servers.log and include timestamps for all operations.

Build docs developers (and LLMs) love