Sniffdogminer icon indicating copy to clipboard operation
Sniffdogminer copied to clipboard

can you add an automatic restart script in the event of a miner's failure?

Open comet-bg opened this issue 8 years ago • 8 comments

@echo off mode con cols=50 lines=10 cls :begin FOR /L %%A IN (60,-1,0) DO ( cls echo Timeout [92;1m%%A[0m seconds... timeout /t 1 >nul ) :start cls :measure for /F %%p in ('"C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi" --id^=0 --query-gpu^=utilization.gpu --format^=csv^,noheader^,nounits') do set gpu_usage0=%%p for /F %%p in ('"C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi" --id^=1 --query-gpu^=utilization.gpu --format^=csv^,noheader^,nounits') do set gpu_usage1=%%p set /a total=%gpu_usage0%+%gpu_usage1% set /a gpu_average=%total%/2

:end_for cls echo Average Usage of *2 GPUs usage is %gpu_average%%% if %gpu_average% GTR 40 ( echo [92;1mMining is working[0m echo [102;92;1mMining is working[0m timeout /t 10 >nul goto :start )

set log_file=mining_problems_log.txt set ping_time=500 FOR /F "skip=8 tokens=10" %%G in ('ping -n 3 google.com') DO set ping_time=%%G if %ping_time% GTR 0 (

echo Control checking of GPUs usage, timeout 20 sec... timeout /t 20 >nul goto:recheck :endrecheck if %gpu_average% GTR 40 ( echo ------------------- %date% %time% reboot warning>> %log_file% goto :start ) echo. echo Average Usage of *2 GPUs usage is [93m%gpu_average%%%[0m echo.

echo ping is [92m%ping_time%[0m - OK, not internet problem timeout /t 5 >nul goto :endif ) :else cls echo %date% %time% No internet connection>> %log_file% echo No internet connection, keep working... timeout /t 5 >nul goto :begin :endif

SET mypath=%~dp0 SET scrpath=%mypath%Scr if not exist "%scrpath%" mkdir "%scrpath%"

"%mypath%nircmd.exe" savescreenshot "%scrpath%%TIME:~0,-9%-%TIME:~3,2%-%TIME:~6,2%.png" echo "%scrpath%%DATE:~6,4%.%DATE:~3,2%.%DATE:~0,2% %TIME:~0,-9%-%TIME:~3,2%-%TIME:~6,2%.png"

echo.>> %log_file% echo ---------------------------------------------------------------------------------------------------->> %log_file% echo.>> %log_file% echo PC was restarted at %date% %time%>> %log_file%, mining issue. GPUs usage is %gpu_average%%% "C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi">> %log_file% echo.>> %log_file% echo ---------------------------------------------------------------------------------------------------->> %log_file% echo.>> %log_file%

echo [101;93mMining is NOT working, rebooting in 10 seconds...[0m timeout /t 10 >nul shutdown.exe /r /t 00 goto :end

:recheck for /F %%p in ('"C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi" --id^=0 --query-gpu^=utilization.gpu --format^=csv^,noheader^,nounits') do set gpu_usage0=%%p for /F %%p in ('"C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi" --id^=1 --query-gpu^=utilization.gpu --format^=csv^,noheader^,nounits') do set gpu_usage1=%%p set /a total=%gpu_usage0%+%gpu_usage1% set /a gpu_average=%total%/2 goto :endrecheck :end

comet-bg avatar Jan 06 '18 08:01 comet-bg

Thanks comet-bg... I'll try that script out... will it work for AMD as well since Sniffdog has AMD files too?

We are getting quotes.... I could include this suggestion as well

Sniffdog avatar Jan 06 '18 14:01 Sniffdog

the script uses NVSMI which is part of the NVIDIA driver, to check the load on each video card. there must be a separate line for each card, as well as a correction of the summation - in my example I use 2 video cards

this method is simple and extremely reliable, but unfortunately is not applicable to AMD video cards

comet-bg avatar Jan 06 '18 21:01 comet-bg

Ok mod me up a 8 card script and I'll place it in Sniffdog files....

Right now I'm modding SplitSniff....

Sniffdog avatar Jan 07 '18 04:01 Sniffdog

here's the 8 GPU version - there must be 8 cards in the system I think this code will have to be modified to work with a variable number of devices

Monitor.zip

comet-bg avatar Jan 07 '18 08:01 comet-bg

Thanks! I'll take a look at it once splitsniff is up and running...

Sniffdog avatar Jan 07 '18 14:01 Sniffdog

I haven't forgotten about you @comet-bg I think for now I'll split this file up and place into a folder... then peeps can use what they want...

Sniffdog avatar Jan 12 '18 16:01 Sniffdog

OK :)

comet-bg avatar Jan 14 '18 17:01 comet-bg

#88 joining issues

Sniffdog avatar Jan 22 '18 05:01 Sniffdog