Bedrock Process Manager Core Documentation

class bedrock_server_manager.BedrockProcessManager(app_context: AppContext)

Bases: object

Manages Bedrock server processes, including monitoring and restarting.

The BedrockProcessManager runs a background monitoring thread that checks the status of registered servers at regular intervals. If a server is found to be stopped without being intentionally stopped (crashed), it attempts to restart it. It also periodically queries server status to update player counts and scan logs for player activity.

servers

A dictionary mapping server names to BedrockServer instances currently being managed.

Type:

Dict[str, BedrockServer]

logger

Logger for the process manager.

Type:

logging.Logger

app_context

The application context.

Type:

AppContext

settings

The application settings.

Type:

Settings

__init__(app_context: AppContext)

Initializes the BedrockProcessManager.

Parameters:

app_context (AppContext) – The global application context, providing access to settings and the main manager.

add_server(server: BedrockServer)

Adds a server to be managed by the process manager.

Parameters:

server (BedrockServer) – The server instance to monitor.

remove_server(server_name: str)

Removes a server from the process manager.

This stops the manager from monitoring the server, but does not stop the server process itself.

Parameters:

server_name (str) – The name of the server to remove.

shutdown()

Signals the monitoring thread to shut down.

This method sets the shutdown event, causing the background monitoring thread to exit its loop. It waits (up to 5 seconds) for the thread to join.

write_error_status(server_name: str)

Writes ‘ERROR’ to server config status.

Parameters:

server_name (str) – The name of the server.

Raises:

FileOperationError – If writing to the config file fails.