• Привет на сайте можно авторизоваться через VK Yandex Discord Google прими участие в обсуждениях.

soft Скрипт на перезапуск майнера и ПК

ElisovSlava

5FPS
Администрация
Сообщения
4,531
Реакции
1,238
Баллы
113
Играю на
PC
Скрипт для видеокарт Nvidia проверяет загруженность видеокарт в пределах 90% и проверяет наличие интернета . Если не соблюдается какое либо из условий компьютер будет перезагружен . Что нужно для старта скрипта ? Создать текстовый документ с расширением txt скопировать содержимое которое будет ниже , сохранить его , и поменять расширение с txt на bat после двойным кликом просто запускаем его . Так же рекомендую поставить скрипт в автозагрузку , как это можно сделать описано тут .

Снимок экрана 2017-12-25 в 12.32.58.png
Код:
@echo off
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
set /a total=%gpu_usage0%
set /a gpu_average=%total%/1

:end_for
cls
echo Average Usage of *1 GPUs usage is %gpu_average%%%
if %gpu_average% GTR 80 (
   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=-1
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 80 (
      echo ------------------- %date% %time% reboot warning>> %log_file%
      goto :start
   )
   echo.
   echo Average Usage of *1 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

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
   set /a total=%gpu_usage0%
   set /a gpu_average=%total%/1
goto :endrecheck
:end

Код:
@echo off
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 80 (
   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=-1
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 80 (
      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

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


Код:
@echo off
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
for /F %%p in ('"C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi" --id^=2 --query-gpu^=utilization.gpu --format^=csv^,noheader^,nounits') do set gpu_usage2=%%p
for /F %%p in ('"C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi" --id^=3 --query-gpu^=utilization.gpu --format^=csv^,noheader^,nounits') do set gpu_usage3=%%p
for /F %%p in ('"C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi" --id^=4 --query-gpu^=utilization.gpu --format^=csv^,noheader^,nounits') do set gpu_usage4=%%p
set /a total=%gpu_usage0%+%gpu_usage1%+%gpu_usage2%+%gpu_usage3%+%gpu_usage4%
set /a gpu_average=%total%/5

:end_for
cls
echo Average Usage of *5 GPUs usage is %gpu_average%%%
if %gpu_average% GTR 80 (
   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=-1
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 80 (
      echo ------------------- %date% %time% reboot warning>> %log_file%
      goto :start
   )
   echo.
   echo Average Usage of *5 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

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
   for /F %%p in ('"C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi" --id^=2 --query-gpu^=utilization.gpu --format^=csv^,noheader^,nounits') do set gpu_usage2=%%p
   for /F %%p in ('"C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi" --id^=3 --query-gpu^=utilization.gpu --format^=csv^,noheader^,nounits') do set gpu_usage3=%%p
   for /F %%p in ('"C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi" --id^=4 --query-gpu^=utilization.gpu --format^=csv^,noheader^,nounits') do set gpu_usage4=%%p
   set /a total=%gpu_usage0%+%gpu_usage1%+%gpu_usage2%+%gpu_usage3%+%gpu_usage4%
   set /a gpu_average=%total%/5
goto :endrecheck
:end
 

Последние ресурсы

Сверху