last fix
This commit is contained in:
parent
44f37dfaff
commit
8f5ad2984a
5 changed files with 106 additions and 73 deletions
|
|
@ -11,10 +11,11 @@
|
|||
- `Agent-Windows/OGP64/OGP/Cfg/Preferences.pm`
|
||||
- `Agent-Windows/OGP64/OGP/Cfg/bash_prefs.cfg`
|
||||
- `Agent-Windows/OGP64/OGP/Cfg/*.default`
|
||||
- `Agent-Windows/OGP64/agent_start.bat`
|
||||
- `Agent-Windows/OGP64/agent_stop.bat`
|
||||
- `Agent-Windows/php-query/`
|
||||
- `Agent-Windows/ArmaBE/`
|
||||
- `Agent-Windows/Cfg/`
|
||||
- `Agent-Windows/Install/`
|
||||
- `Agent-Windows/ServerFiles/`
|
||||
- `Agent-Windows/Schedule/`
|
||||
|
||||
|
|
@ -51,40 +52,33 @@ OGP_HOME_000000123
|
|||
|
||||
Relevant files:
|
||||
|
||||
- `Agent-Windows/Install/agent_start.bat`
|
||||
- `Agent-Windows/Install/agent_start_cygwin.sh`
|
||||
- `Agent-Windows/OGP64/agent_start.bat`
|
||||
- `Agent-Windows/OGP64/agent_stop.bat`
|
||||
- `/OGP/Cfg/bash_prefs.cfg` on an installed node
|
||||
|
||||
The batch launcher must not assume that `bash` is in the Windows `PATH`. It explicitly checks:
|
||||
|
||||
- `%~dp0bin\bash.exe`
|
||||
- `%~dp0..\bin\bash.exe`
|
||||
- `%~dp0..\..\bin\bash.exe`
|
||||
- `C:\OGP64\bin\bash.exe`
|
||||
- `C:\cygwin64\bin\bash.exe`
|
||||
- `C:\cygwin\bin\bash.exe`
|
||||
|
||||
This matters because the maintained launcher may be run from `C:\OGP64\agent_start.bat` or from `C:\OGP64\OGP\Install\agent_start.bat`. In the second case the actual Cygwin root is two directories above the launcher, so `C:\OGP64\bin\bash.exe` must be checked.
|
||||
The supported manual launcher is `C:\OGP64\agent_start.bat`. The Cygwin root is the folder containing that BAT file, so the path checks stay simple and deterministic.
|
||||
|
||||
Manual launches pause on fatal errors so the error remains visible. Service or scheduled-task wrappers can set `GSP_AGENT_NO_PAUSE=1` to return immediately instead of waiting forever at a `pause` prompt.
|
||||
Manual launches pause on fatal errors so the error remains visible.
|
||||
|
||||
The launcher now prints the detected script directory, Cygwin root, `bash.exe` path, OGP path, `ogp_agent.pl` path, config path, and startup log path before it launches the shell helper. The goal is to keep the original failure visible in the same console window instead of replacing it with a generic wrapper message.
|
||||
The launcher prints the detected Cygwin root and agent user before validation, then keeps all startup output in the same console window. It does not spawn a second generic wrapper window.
|
||||
|
||||
The Cygwin-side helper performs the shell work:
|
||||
The BAT launcher performs the shell work directly:
|
||||
|
||||
1. enter `/OGP`
|
||||
2. normalize CRLF to LF for `.pl`, `.pm`, `.sh`, and `.cfg` files under `/OGP`
|
||||
3. create missing `Cfg/Config.pm`, `Cfg/Preferences.pm`, and `Cfg/bash_prefs.cfg` from tracked `.default` files
|
||||
4. strip CRLF and leading whitespace before assignments in `/OGP/Cfg/bash_prefs.cfg`
|
||||
5. source `/OGP/Cfg/bash_prefs.cfg`
|
||||
6. set up `gsp_agent_start.log` under `/var/log` by default, or the native `C:\OGP64\var\log\gsp_agent_start.log` path when passed from the batch wrapper
|
||||
7. tee stdout and stderr to the startup log while still printing live output in the same console
|
||||
8. optionally update only the Windows agent file from Forgejo when `agent_auto_update=1`
|
||||
9. backup the current `/OGP/ogp_agent.pl`
|
||||
10. validate downloaded and installed agent files with content checks plus `perl -c`
|
||||
11. restore the backup if validation fails
|
||||
12. refuse to launch if `Cfg/Config.pm` still contains placeholder values
|
||||
13. launch `/OGP/ogp_agent.pl`
|
||||
6. verify the Windows account `gameserver` exists
|
||||
7. run `perl -c ./ogp_agent.pl` before launch
|
||||
8. launch `/OGP/ogp_agent.pl`
|
||||
|
||||
Default optional update source:
|
||||
|
||||
|
|
@ -100,19 +94,14 @@ Restart-time auto-update is allowlisted. It may replace only `/OGP/ogp_agent.pl`
|
|||
|
||||
### Startup Log And Troubleshooting
|
||||
|
||||
Default startup log:
|
||||
|
||||
- `/var/log/gsp_agent_start.log` inside Cygwin
|
||||
- `C:\OGP64\var\log\gsp_agent_start.log` when launched through the Windows batch wrapper
|
||||
|
||||
If startup fails, the batch wrapper prints the last 100 lines of that log in the same console window before pausing. This is the primary place to look for the real cause of a bad config, missing package, or bad downloaded agent file.
|
||||
The launcher does not create a separate startup wrapper window. If startup fails, the real Perl or config error remains in the same console window before the pause prompt. This is the primary place to look for a bad config, missing package, or bad downloaded agent file.
|
||||
|
||||
Manual troubleshooting flow:
|
||||
|
||||
1. Launch `agent_start.bat` directly from the Windows console or Explorer.
|
||||
1. Launch `C:\OGP64\agent_start.bat` directly from the Windows console or Explorer.
|
||||
2. Read the path summary printed at the top of the window.
|
||||
3. Check the log tail printed on failure.
|
||||
4. Inspect `gsp_agent_start.log` for the full startup sequence.
|
||||
3. Inspect the same window for the real Perl/config error.
|
||||
4. Check the current Cygwin output if you need more context.
|
||||
|
||||
### Auto-Update Allowlist
|
||||
|
||||
|
|
@ -132,6 +121,10 @@ It must never overwrite:
|
|||
- user-created files
|
||||
- passwords or keys
|
||||
|
||||
### Windows User Account
|
||||
|
||||
The Windows/Cygwin startup path uses the `gameserver` user account. It does not reference `cyg_server` in the agent start logic. The installer and service bootstrap flow should create or verify `gameserver` before the agent is launched.
|
||||
|
||||
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.
|
||||
|
||||
Required Cygwin Perl packages include `perl`, `perl_vendor`, `perl-HTTP-Daemon`, `perl-Path-Class`, `perl-XML-Parser`, `perl-XML-Simple`, `perl-Archive-Zip`, and `perl-Archive-Extract`. A clean non-Cygwin Linux workstation may fail `perl -c` on these dependencies even though the bundled Windows Cygwin tree contains them.
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ Common installed layout:
|
|||
- Cygwin root: `C:\OGP64`
|
||||
- Bash: `C:\OGP64\bin\bash.exe`
|
||||
- Agent root: `C:\OGP64\OGP`
|
||||
- Maintained launcher: `C:\OGP64\OGP\Install\agent_start.bat`
|
||||
- Convenience launcher: `C:\OGP64\agent_start.bat`
|
||||
- Maintained launcher: `C:\OGP64\agent_start.bat`
|
||||
- Stop launcher: `C:\OGP64\agent_stop.bat`
|
||||
|
||||
The launcher checks `%~dp0bin\bash.exe`, `%~dp0..\bin\bash.exe`, `%~dp0..\..\bin\bash.exe`, `C:\OGP64\bin\bash.exe`, `C:\cygwin64\bin\bash.exe`, and `C:\cygwin\bin\bash.exe`. Missing-bash errors should print every checked path and pause in manual use. Set `GSP_AGENT_NO_PAUSE=1` for service/non-interactive wrappers that should fail fast instead of waiting at a prompt.
|
||||
The launcher checks `%~dp0bin\bash.exe`, `C:\OGP64\bin\bash.exe`, `C:\cygwin64\bin\bash.exe`, and `C:\cygwin\bin\bash.exe`. Missing-bash errors should print every checked path and pause in manual use.
|
||||
|
||||
Generated config files under `/OGP/Cfg` are production state. Installer/startup may create them from `.default` templates if missing, but update logic must preserve them. Restart-time auto-update may replace only `/OGP/ogp_agent.pl`; it must not overwrite `Cfg/Config.pm`, `Cfg/Preferences.pm`, `Cfg/bash_prefs.cfg`, service settings, passwords, server data, or logs.
|
||||
|
||||
When the Windows agent starts, the batch wrapper now writes the startup log to `C:\OGP64\var\log\gsp_agent_start.log` when that Cygwin root is detected, and the Cygwin helper tees live output to `/var/log/gsp_agent_start.log` inside the shell environment. Manual failures print the last 100 lines of that log before the console pauses, so the original error remains visible in the same window.
|
||||
When the Windows agent starts, `C:\OGP64\agent_start.bat` should be launched from the Cygwin root itself. It verifies the `gameserver` account, normalizes text files, validates `OGP\ogp_agent.pl`, and then launches the agent in the same console window. It should not call an installer wrapper from the start script.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue