Files
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

36 lines
738 B
Batchfile

@echo off
if "%1"=="" (
SET COMMAND=start
) else (
SET COMMAND=%1
)
rem get pid
SET PID=
FOR /F "tokens=3" %%a in ('WMIC PROCESS WHERE "Caption='php.exe'" get Commandline^, Processid^|findstr chat-server') DO (
SET PID=%%a
)
echo Executing command [%COMMAND%]
rem check if running
if "%PID%" == "" (
echo [MgVideoChat] Not running
SET RUNNING=no
) else (
echo [MgVideoChat] Running with PID: [%PID%]
SET RUNNING=yes
)
rem start or stop
if "%COMMAND%" == "stop" (
if "%RUNNING%" == "yes" (
echo [MgVideoChat] stopping
taskkill /f /pid %PID%
)
) else (
if "%RUNNING%" == "no" (
echo [MgVideoChat] start
start /b php chat-server.php > mg-chat-server.log
)
)