REM line 1
REM Team70335_downloadfix.bat
REM Windows-script to reboot PC after inactivity of FAHclient for Windows
REM by team members of folding team PC Games Hardware - 70335
REM Credits to 70335-team members brooker, mattinator and foldinghomealone for inspiration and coding
REM Special thanks to all folders
REM Change log
REM
REM IP /release and /renew added before reboot
REM Client kill before IP renew
REM How To
REM FAH Client needs to be autostarted after boot
REM Script needs to be autostarted after boot
REM
REM Script needs to be modified user specific:
REM If download time of a WU is longer than 60sec --> lines 63 and 109
REM Client config-data and installation directories --> lines 94 and 95
REM
REM ________________
@echo off
REM Unpause FahClient
REM Wird benötigt, falls der Client beim Windowsstart normalerweise nicht falten soll
REM Hier muss aber aber falten, sonst macht das Skript bzw. der Neustart des Rechners keinen Sinn
REM Client must be unpaused, otherwise checking for folding activity is useless
REM es wird erstmal 30 Sekunden gewartet, so dass sichergestellt ist, dass der Client nach Neustart gestartet wurde bevor das Unpause-Signal gesendet wird
REM waiting for 30sec to ensure Client has started before unpause command is sent
timeout /T 30 /NOBREAK
FAHCLIENT --send-unpause
REM dann wird nochmal gewartet, bevor die erste Prüfroutine gestartet wird. Zeit kann auch angepasst werden
REM waiting time before checking first check starts
timeout /T 30 /NOBREAK
echo %date% %time% Prüfroutine gestartet // Checking starts >>fah_skript.log
echo %date% %time% Credits to 70335-team members brooker, mattinator and foldinghomealone >>fah_skript.log
echo %date% %time% Special thanks to all folders >>fah_skript.log
:START
echo.
echo Prüfen ob der Prozess FahCore_2x läuft // Checking if process FahCore_2x is running
tasklist | findstr "FahCore_2"
REM "FahCore_2" prüft ob GPU, "FahCore_A" prüft ob CPU, "FahCore_" prüft ob GPU ODER CPU falten
REM "FahCore_2" checks if GPU, "FahCore_A" checks if CPU, "FahCore_" checks if GPU or CPU are folding
IF ERRORLEVEL 1 ( GOTO :WIEDERHOLEPRFNG ) ELSE ( GOTO :VONANFANGAN )
:WIEDERHOLEPRFNG
REM nach 60 Sekunden wird Prüfung wiederholt // Repeat check after 60sec
echo.
echo FahCore_2x.exe ist nicht aktiv. Wiederholte Prüfung in 60sec. // FahCore_2x not active. Repeated check in 60sec
echo Falls dann immer noch nicht aktiv, wird IP neu zugewiesen. // If still not active, IP renewed
timeout /T 60 /NOBREAK
REM Zeit verlängern, falls normaler Download einer WU länger als 60sec dauert // Extend time if a normal download of a WU takes longer than 60sec
tasklist | findstr "FahCore_2"
IF ERRORLEVEL 1 ( GOTO :IPNEUZUWEISUNG ) ELSE ( GOTO :VONANFANGAN )
:IPNEUZUWEISUNG
REM Tests haben gezeigt, dass IP Zuweisung nicht immer funktioniert und man Zeit sparen kann, wenn gleich ein Neustart durchgeführt wird
REM Soll gleich ein Neustart ausgeführt werden, gleich auf Neustart springen
REM Tests showed that IP renew doesn't work all the time. To save time make directly a reboot with following command:
REM GOTO :NEUSTART
echo.
echo FahCore_2x.exe ist nicht aktiv. IP wird neu zugewiesen // FahCore_2x not active, IP renew
echo %date% %time% IP neu zuweisen // IP renew >>fah_skript.log
REM Client muss erst geschlossen werden // Client needs to be killed first
taskkill /im fahclient.exe
taskkill /im fahcontrol.exe
timeout /T 10
REM IP Neuzuweisung // IP renew
ipconfig /release
timeout /T 5
ipconfig /renew
REM Client Neustart // Client restarted
REM Pfad des Ordners FAHClient der Config-Daten und des Installationsverzeichnisses müssen angepasst werden
REM Path of FAHClient config-data and of installation directory must be adjusted
cd /d %UserProfile%\AppData\Roaming\FAHClient
"C:\Program Files (x86)\FAHClient\HideConsole.exe" "C:\Program Files (x86)\FAHClient\FAHClient.exe"
timeout /T 10 /NOBREAK
FAHCLIENT --send-unpause
GOTO :WIEDERHOLEPRFNG2
:WIEDERHOLEPRFNG2
REM nach 60 Sekunden wird Prüfung wiederholt // check is repeated after 60sec
echo.
echo IP wurde neu zugewiesen. Wiederholte Prüfung ob FahCore_2x.exe aktiv ist in 60sec. // IP renewed. Repeated check if FahCore_2x is active in 60sec
echo Falls dann immer noch nicht aktiv, wird Neustart durchgeführt. // if still not active, reboot
timeout /T 60 /NOBREAK
tasklist | findstr "FahCore_2"
IF ERRORLEVEL 1 ( GOTO :NEUSTART ) ELSE ( GOTO :VONANFANGAN )
:VONANFANGAN
echo.
echo FahCore_2x.exe ist aktiv, alles in Ordnung! // FahCore_2x is active, everything allright
echo Wird eine Taste gedrückt, wird die Prüfung sofort wiederholt und nicht bis Ablauf des Timers gewartet // Press key and check will be repeated immediately
REM In 300 Sekunden erfolgt eine erneute Abfrage ob der Prozess läuft. Der Wert kann ebenfalls nach Bedarf angepasst werden.
REM Repeat check every 300sec. Value can be adjusted
echo %date% %time% Falten aktiv // Folding active >>fah_skript.log
timeout /T 300
goto :START
:NEUSTART
echo.
echo FahCore_2x.exe ist nicht aktiv. Neustart wird sofort eingeleitet! // FahCore_2x not active. Reboot immediately initiated
echo %date% %time% Neustart durchgeführt // Reboot initiated >>fah_skript.log
shutdown /r /f