You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:: Wait until the Docker engine is ready (safety timeout ~2 min)
set /a COUNT=120
:WAITDOCKER
cls @echo. @echo %ESC%[33m== Waiting for Docker to be ready (max 2 min)...%ESC%[0m @echo %ESC%[90m- %ESC%[36m%COUNT%%ESC%[0m sec.
docker.exe info >nul 2>&1
if not errorlevel 1 goto DOCKERREADY
set /a COUNT-=1
if %COUNT% EQU 0 (
echo %ESC%[31mError: Docker did not start in time.%ESC%[0m
pause
exit /b 1
)
timeout /t 1 /nobreak >nul
goto WAITDOCKER
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi!
I create a batch to update and launch Stirling PDF in Windows, it helps to avoid a lot of steps in every start.
@echo off
Title Stirling PDF
:: Generate real ESC character for ANSI colors
for /F %%a in ('echo prompt $E^|cmd') do set "ESC=%%a"
:: Start Docker Desktop
Start "" "%LOCALAPPDATA%\Programs\DockerDesktop\Docker Desktop.exe"
:: Wait until the Docker engine is ready (safety timeout ~2 min)
set /a COUNT=120
:WAITDOCKER
cls
@echo.
@echo %ESC%[33m== Waiting for Docker to be ready (max 2 min)...%ESC%[0m
@echo %ESC%[90m- %ESC%[36m%COUNT%%ESC%[0m sec.
docker.exe info >nul 2>&1
if not errorlevel 1 goto DOCKERREADY
set /a COUNT-=1
if %COUNT% EQU 0 (
echo %ESC%[31mError: Docker did not start in time.%ESC%[0m
pause
exit /b 1
)
timeout /t 1 /nobreak >nul
goto WAITDOCKER
:DOCKERREADY
echo %ESC%[32mDocker Ready!%ESC%[0m
@echo %ESC%[33m== Updating Stirling PDF...%ESC%[0m
@echo.%ESC%[90m
docker.exe pull stirlingtools/stirling-pdf:latest-fat >nul 2>&1
docker.exe stop stirling-pdf >nul 2>&1
docker.exe rm stirling-pdf >nul 2>&1
docker.exe run -d -p 8080:8080 --name stirling-pdf -e SECURITY_ENABLELOGIN=false -e SYSTEM_DEFAULTLOCALE=en_US stirlingtools/stirling-pdf:latest-fat >nul 2>&1
:: Wait until Stirling PDF responds on localhost:8080 (timeout ~2 min)
set /a COUNT=120
:WAITAPP
cls
@echo.
@echo %ESC%[32m== Waiting for Stirling PDF to start (max 2 min)...%ESC%[0m
@echo %ESC%[90m- %ESC%[33m%COUNT%%ESC%[0m sec.
powershell -Command "try { (Invoke-WebRequest -Uri 'http://localhost:8080' -UseBasicParsing -TimeoutSec 2).StatusCode } catch { exit 1 }" >nul 2>&1
if not errorlevel 1 goto APPREADY
set /a COUNT-=1
if %COUNT% EQU 0 (
echo %ESC%[31mError: Stirling PDF did not respond in time.%ESC%[0m
pause
exit /b 1
)
timeout /t 1 /nobreak >nul
goto WAITAPP
:APPREADY
echo %ESC%[32mStirling PDF Ready.%ESC%[0m
start "" http://localhost:8080
echo.
echo %ESC%[33mPress any key to stop Stirling PDF...%ESC%[0m
pause >nul
docker stop stirling-pdf
exit
I hope it helps.
All reactions