Harden Windows service supervision
This commit is contained in:
@@ -3,6 +3,14 @@ setlocal
|
||||
|
||||
cd /d "%~dp0"
|
||||
|
||||
powershell -NoProfile -Command "if (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { exit 0 } else { exit 1 }" >nul 2>&1
|
||||
if not "%ERRORLEVEL%"=="0" (
|
||||
set "DOCUTRANSLATE_SETUP_BAT=%~f0"
|
||||
echo [INFO] Administrator permission is required. Opening the UAC prompt...
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process -FilePath $env:DOCUTRANSLATE_SETUP_BAT -Verb RunAs"
|
||||
exit /b
|
||||
)
|
||||
|
||||
set "TASK_NAME=DocuTranslate"
|
||||
set "WATCHDOG_TASK_NAME=DocuTranslateWatchdog"
|
||||
set "PROJECT_DIR=%~dp0"
|
||||
@@ -55,4 +63,7 @@ echo.
|
||||
echo You can start it now with:
|
||||
echo schtasks /Run /TN "%TASK_NAME%"
|
||||
echo.
|
||||
echo Double-click check_autostart.bat to verify tasks and HTTP health.
|
||||
echo Double-click diagnose_service.bat to collect restart and failure evidence.
|
||||
echo.
|
||||
pause
|
||||
|
||||
Reference in New Issue
Block a user