Initial Windows agent repository
This commit is contained in:
commit
a0db0c2e5b
10589 changed files with 3844063 additions and 0 deletions
81
OGP64/agent_start.bat
Normal file
81
OGP64/agent_start.bat
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
@echo off
|
||||
setlocal
|
||||
|
||||
REM GSP / OGP Windows Agent start script
|
||||
REM Cygwin root is the folder containing this BAT file, usually C:\OGP64
|
||||
|
||||
set "WD=%~dp0"
|
||||
pushd "%WD%"
|
||||
|
||||
set "PATH=%WD%bin;%WD%usr\sbin;%PATH%"
|
||||
set "CYGWIN=server ntsec"
|
||||
set "SHELL=/bin/bash"
|
||||
set "AGENT_USER=gameserver"
|
||||
|
||||
echo Starting GSP Windows Agent...
|
||||
echo Cygwin root: %WD%
|
||||
echo Agent user: %AGENT_USER%
|
||||
|
||||
if not exist "%WD%bin\bash.exe" (
|
||||
echo ERROR: bash.exe not found at "%WD%bin\bash.exe"
|
||||
echo This script must be run from the Cygwin root folder, for example C:\OGP64
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if not exist "%WD%OGP\ogp_agent.pl" (
|
||||
echo ERROR: "%WD%OGP\ogp_agent.pl" not found.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if not exist "%WD%OGP\Cfg\Config.pm" (
|
||||
echo Creating default Cfg\Config.pm from Config.pm.default...
|
||||
copy /Y "%WD%OGP\Cfg\Config.pm.default" "%WD%OGP\Cfg\Config.pm" >nul
|
||||
)
|
||||
if not exist "%WD%OGP\Cfg\Preferences.pm" (
|
||||
echo Creating default Cfg\Preferences.pm from Preferences.pm.default...
|
||||
copy /Y "%WD%OGP\Cfg\Preferences.pm.default" "%WD%OGP\Cfg\Preferences.pm" >nul
|
||||
)
|
||||
if not exist "%WD%OGP\Cfg\bash_prefs.cfg" (
|
||||
echo Creating default Cfg\bash_prefs.cfg from bash_prefs.cfg.default...
|
||||
copy /Y "%WD%OGP\Cfg\bash_prefs.cfg.default" "%WD%OGP\Cfg\bash_prefs.cfg" >nul
|
||||
)
|
||||
|
||||
REM Verify gameserver user exists
|
||||
net user %AGENT_USER%
|
||||
if errorlevel 1 (
|
||||
echo ERROR: Windows user "%AGENT_USER%" was not found.
|
||||
echo Create the gameserver user or update AGENT_USER in this script.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Normalize line endings for known text files only
|
||||
"%WD%bin\bash.exe" -lc "cd /OGP && find . -type f \( -name '*.pl' -o -name '*.pm' -o -name '*.sh' -o -name '*.cfg' \) -exec sed -i 's/\r$//' {} \;"
|
||||
|
||||
REM Validate Perl before starting
|
||||
"%WD%bin\bash.exe" -lc "cd /OGP && perl -c ./ogp_agent.pl"
|
||||
if errorlevel 1 (
|
||||
echo ERROR: ogp_agent.pl failed Perl validation.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Stop stale PID processes if present
|
||||
if exist "%WD%var\run\pure-ftpd.pid" set /p PID1=<"%WD%var\run\pure-ftpd.pid"
|
||||
if exist "%WD%OGP\ogp_agent.pid" set /p PID2=<"%WD%OGP\ogp_agent.pid"
|
||||
if exist "%WD%OGP\ogp_agent_run.pid" set /p PID3=<"%WD%OGP\ogp_agent_run.pid"
|
||||
|
||||
if not "%PID1%"=="" "%WD%bin\kill.exe" -15 %PID1%
|
||||
if not "%PID2%"=="" "%WD%bin\kill.exe" -15 %PID2%
|
||||
if not "%PID3%"=="" "%WD%bin\kill.exe" -15 %PID3%
|
||||
|
||||
echo Launching agent...
|
||||
"%WD%bin\bash.exe" -lc "cd /OGP && ./ogp_agent.pl -pidfile /OGP/ogp_agent_run.pid"
|
||||
|
||||
echo.
|
||||
echo GSP Windows Agent exited with error code %ERRORLEVEL%.
|
||||
echo Review the messages above.
|
||||
pause
|
||||
exit /b %ERRORLEVEL%
|
||||
Loading…
Add table
Add a link
Reference in a new issue