neustart und alles inw arteschalnge des gleichen typs auf einmal holen
This commit is contained in:
26
neustart_agent.bat
Normal file
26
neustart_agent.bat
Normal file
@@ -0,0 +1,26 @@
|
||||
@echo off
|
||||
rem ===================================================================
|
||||
rem Skrift-Agent neu starten (zum Doppelklicken).
|
||||
rem 1) laufende agent.py-Instanz(en) beenden
|
||||
rem 2) fensterlos frisch starten (ueber run_agent.vbs)
|
||||
rem ===================================================================
|
||||
cd /d "%~dp0"
|
||||
|
||||
echo Beende laufende Agent-Instanz(en)...
|
||||
powershell -NoProfile -Command "Get-CimInstance Win32_Process | Where-Object { $_.Name -eq 'python.exe' -and $_.CommandLine -like '*agent.py*' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }"
|
||||
|
||||
rem kurz warten, damit der Prozess wirklich weg ist (ping statt timeout: braucht kein stdin)
|
||||
"%SystemRoot%\System32\ping.exe" -n 2 127.0.0.1 >nul
|
||||
|
||||
echo ##### NEUSTART #####>> "logs\agent.log"
|
||||
|
||||
echo Starte Agent neu...
|
||||
wscript.exe "%~dp0run_agent.vbs"
|
||||
|
||||
rem kurz warten und pruefen, ob wieder eine Instanz laeuft
|
||||
"%SystemRoot%\System32\ping.exe" -n 5 127.0.0.1 >nul
|
||||
powershell -NoProfile -Command "$n = @(Get-CimInstance Win32_Process | Where-Object { $_.Name -eq 'python.exe' -and $_.CommandLine -like '*agent.py*' }).Count; if ($n -gt 0) { Write-Host 'OK: Agent laeuft wieder.' -ForegroundColor Green } else { Write-Host 'WARNUNG: Keine Instanz gefunden - Log pruefen.' -ForegroundColor Red }"
|
||||
|
||||
echo.
|
||||
echo Fenster schliesst sich in 3 Sekunden...
|
||||
"%SystemRoot%\System32\ping.exe" -n 4 127.0.0.1 >nul
|
||||
Reference in New Issue
Block a user