4.1 KiB
Windows Agent
Role
Agent-Windows/ogp_agent.pl is the Windows/Cygwin execution agent for GSP. It mirrors the Linux agent as closely as practical, while using Windows-compatible paths, processes, and wrappers.
Important Files
Agent-Windows/ogp_agent.plAgent-Windows/php-query/Agent-Windows/ArmaBE/Agent-Windows/Cfg/Agent-Windows/Install/Agent-Windows/ServerFiles/Agent-Windows/Schedule/
Cygwin Requirements
The Windows agent assumes a Cygwin-style environment that can provide:
screen- Perl
- shell utilities such as
ps,grep,cut,awk,sed cygpath- a usable
bash
The goal is to keep the Windows agent behavior close to the Linux agent so the Panel does not need separate semantics for basic lifecycle operations.
Startup Logic
Relevant functions:
universal_start_without_decryptcreate_screen_cmdcreate_screen_cmd_loopreplace_OGP_Env_Vars
The Windows agent also uses screen sessions for managed server execution. Depending on the game and binary type, it may wrap commands in cmd /Q /C start or run a batch file wrapper.
The session naming scheme also follows the OGP convention:
OGP_HOME_000000123
Windows Startup Launcher
Relevant files:
Agent-Windows/Install/agent_start.batAgent-Windows/Install/agent_start_cygwin.sh/OGP/Cfg/bash_prefs.cfgon an installed node
The batch launcher must not assume that bash is in the Windows PATH. It explicitly checks:
- the Cygwin root beside the launcher
C:\cygwin64\bin\bash.exeC:\cygwin\bin\bash.exe
The Cygwin-side helper performs the shell work:
- enter
/OGP - normalize CRLF to LF for
.pl,.pm,.sh, and.cfgfiles under/OGP - source
/OGP/Cfg/bash_prefs.cfg - optionally update only
Agent-Windows/ogp_agent.plfrom Forgejo whenagent_auto_update=1 - backup the current
/OGP/ogp_agent.pl - validate the updated agent with
perl -c - restore the backup if validation fails
- launch
/OGP/ogp_agent.pl
Default optional update source:
- repo:
http://forge.runlevelsystems.com/dev/GSP.git - branch:
Panel-unstable - source file:
Agent-Windows/ogp_agent.pl - target file:
/OGP/ogp_agent.pl
Auto-update failure is non-fatal. Missing git, clone failure, missing source file, or failed validation should warn and continue with the current installed agent.
The Windows agent file does not use DBI at startup. If a Windows node reports Can't locate DBI.pm at line 48, it is a strong signal that a Linux agent file was copied onto the Windows node.
Status Logic
Relevant functions:
is_screen_running_without_decryptget_screen_pid_without_decryptserver_status_without_decryptverify_server_stopped_without_decrypt
The status model should check:
- screen/session existence
- process/PID information when available
- game port listening
- optional query metadata
The old SERVER_STOPPED file should not be the source of truth.
If the game port is listening but the managed screen session is not found, the agent reports ONLINE with a warning. This protects customers from false offline/unknown states when a process survives a screen/session mismatch or an older agent cannot report the session correctly.
Logging
Relevant function:
get_log
Windows/Cygwin logs come from screen logs and/or local copies. Log retrieval should remain compatible with the Panel's AJAX log view.
Scheduler
Relevant functions:
scheduler_dispatcherscheduler_server_actionscheduler_log_eventsscheduler_add_taskscheduler_del_taskscheduler_edit_taskscheduler_read_tasksscheduler_stopscheduler_list_tasks
The Windows scheduler implementation should remain aligned with the Linux scheduler implementation so the Panel can treat both the same way.
Windows-Specific Notes
- Path conversion between Cygwin and native Windows paths matters during startup.
- Batch wrappers are often needed for Windows executables.
- Process cleanup must avoid killing unrelated processes that happen to share an executable name.
- The agent should continue to use
screenwhere it already does so, to stay aligned with Linux behavior.