Skip to main content

Overview

GamePanelX V3 uses the CreateServer script to create new game server instances from templates. The script handles directory setup, template extraction, and optional automatic server startup.

Basic Usage

The CreateServer script is located at ~/_SERVERS/scripts/CreateServer and supports both creation-only and create-and-start workflows.

Create Only

Create a server without starting it:
./CreateServer -u user123 -i 192.168.10.10 -p 27015 -x 27

Create and Start

Create a server and start it immediately:
./CreateServer -u user123 -i 192.168.10.10 -p 27015 -x 27 -s yes \
  -P server.pid \
  -o './srcds_run -game cstrike -ip 192.168.10.10 -port 27015 +map de_dust2'

Command-Line Parameters

-u
string
required
UsernameThe client’s GPX username. This determines the account directory structure.
-i
string
required
IP AddressThe server’s IP address (e.g., 192.168.10.10). Used in the directory path.
-p
string
required
PortThe server port number (e.g., 27015). Combined with IP for unique identification.
-x
string
required
Template IDThe template ID to use for server creation. References a template file at ~/templates/{id}.tar.gz.
-s
string
Start ServerWhether to start the server after creation. Use yes or y to enable.
-w
string
Working DirectoryThe working directory to change into before starting the server (relative path).
-P
string
PID FileServer PID filename for tracking the process. Use local paths like some/dir/run.pid.
-o
string
Command LineComplete command-line string to execute for starting the server.
-c
string
Callback URLURL to notify about creation status. Receives status=complete or status=failed callbacks.

Server Creation Process

1

Validation

The script validates that all required parameters are provided and checks if the server directory already exists.
2

Directory Creation

Creates the server directory at ~/accounts/{username}/{ip}.{port}.
3

Template Extraction

Extracts the specified template archive into the server directory:
tar -zxf ~/templates/{template_id}.tar.gz -C {server_directory}/
The extraction process ID is saved to .gpx_template for monitoring.
4

Completion Check

The script monitors the extraction process and waits for completion.
5

Optional Startup

If -s yes is specified, the script calls the Restart script to start the server once extraction completes.

Directory Structure

After successful creation, the server directory structure will be:
~/accounts/
└── {username}/
    └── {ip}.{port}/
        ├── .gpx_template       # Template extraction PID
        └── [template files]    # Extracted game server files

Examples

./CreateServer \
  -u john123 \
  -i 192.168.1.100 \
  -p 27015 \
  -x 10 \
  -s yes \
  -w orangebox \
  -o './srcds_run -game cstrike -ip 192.168.1.100 -port 27015 +map de_dust2 +maxplayers 16'

Status Callbacks

When a callback URL is provided with -c, the script sends HTTP requests to notify about status changes:
StatusWhen Triggered
completeTemplate extraction finished successfully
failedRequired parameters missing or directory already exists
Callback format:
{callback_url}&do=createsrv_status&status={complete|failed}

Error Handling

The script will exit with an error message if:
  • Required parameters (-u, -i, -p, -x) are missing
  • The server directory already exists at ~/accounts/{username}/{ip}.{port}
  • The template extraction process cannot be started
All operations are logged to ~/logs/servers.log for troubleshooting.

Automatic Server Startup

When using -s yes, the script automatically calls the Restart script after template extraction completes. The startup parameters are passed through:
  • If -w (working directory) is specified, it’s passed to Restart
  • If -P (PID file) is specified, it’s passed to Restart
  • The command line from -o is always passed to Restart
See Starting, Stopping, Restarting Servers for more details on the server lifecycle.

Best Practices

  1. Unique Identifiers: Always use unique IP/port combinations for each server
  2. Template Validation: Ensure templates exist at ~/templates/{id}.tar.gz before creating servers
  3. Command Line Testing: Test command lines manually before using them with -s yes
  4. Callback URLs: Use callback URLs for monitoring creation status in web interfaces
  5. Logging: Monitor ~/logs/servers.log for detailed creation progress

Build docs developers (and LLMs) love