Post
Topic
Board Mining (Altcoins)
Re: Need simple batch restart miner when GPU not working
by
DJMinerOne
on 15/01/2018, 20:37:34 UTC
Totally agree!  One way I helped with the automation on that is to have a non-mining PC that is on the same network do a ping to the miner at a specific time interval.  If the ping fails, then it sends a text to my phone and make it my decision on whether or not to re-boot via the smart plug.  (That central PC could also issue the command to the smart plug to reboot, but I figured at some point a human has to get involved).

Here's a snippet of code from that .bat




can you attach here the bat file Smiley not so practice with that Cheesy

Hope it meets your needs...

echo off
rem *****************************************************************************************************************
rem *                                                                                                               *
rem *  Objective:  Determine if an IP address is pingable (online).  If not                                         *
rem *              send a text message using gmail.  (I know this code could be tightened up... but it works.       *
rem *                                                                                                               *
rem *  Components:  BLAT.exe ( https://sourceforge.net/projects/blat/?source=typ_redirect)                          *
rem *               STUNNEL.exe (https://www.stunnel.org/downloads.html)                                            *
rem *                    Follow these instructions to install the above:                                            *
rem *                    https://blog.frogslayer.com/sending-an-email-through-google-smtp-via-windows-command-line/ *
rem *                                                                                                               *
rem *  IMPORTANT:  Password is stored unencrypted in this batch file.  So do not use an important e-mail account    *
rem *                                                                                                               *
rem *  Create date:  2017-10-29 DJJ                                                                                 *
rem *  Change log:                                                                                                  *
rem *                                                                                                               *
rem *****************************************************************************************************************

rem *** This is gmail's server
set SERVER=127.0.0.1:1099

set USER=your-gmail-address-here@gmail.com
set PW=your-gmail-password-here
set FROMNAME=your-name

rem ***   Put the send-to phone number for SMS below.  "@vtext.com" works for verizon, you'd have to find appropriate domain for your carrier.
set TO=1234567890@vtext.com
set SUBJECT1="Miner1 did not respond to ping"
set SUBJECT2="Miner2 did not respond to ping"
set SUBJECT3="Miner3 did not respond to ping"
set ONLINE1="Miner1 now responding to ping"
set ONLINE2="Miner2 now responding to ping"
set ONLINE3="Miner3 now responding to ping"

rem *** Note this will only work for static IP addresses.  You can also use computer name.  "set IPV4_MINER1=Miner1" (assuming "Miner1" is computer name).
set IPV4_MINER1=10.0.0.39
set IPV4_MINER2=10.0.0.40
set IPV4_MINER3=10.0.0.42
set IPV4_TEST=10.0.0.19

rem *** The idea behind the counter is I only want two messages sent to me when miner goes down.
set /a MINER1_CTR=1
set /a MINER2_CTR=1
set /a MINER3_CTR=1

:STARTPING1

PING -n 1 %IPV4_MINER1%
PING -n 1 %IPV4_MINER1%|find "TTL" >NUL
IF     ERRORLEVEL 1 goto :MINER1OFFLINE
IF %MINER1_CTR% NEQ 1 (
   blat -server %SERVER% -f %FROMNAME% -u %USER% -pw %PW% -to %TO% -subject %ONLINE1% -body "%DATE% - %TIME%"
   set /a MINER1_CTR=1
   )
goto :STARTPING2

:MINER1OFFLINE

if %MINER1_CTR% gtr 2 goto :STARTPING2
blat -server %SERVER% -f %FROMNAME% -u %USER% -pw %PW% -to %TO% -subject %SUBJECT1% -body "%DATE% - %TIME%"
set /a MINER1_CTR+=1

:STARTPING2
PING -n 1 %IPV4_MINER2%
PING -n 1 %IPV4_MINER2%|find "TTL" >NUL
IF     ERRORLEVEL 1 goto :MINER2OFFLINE
IF %MINER2_CTR% NEQ 1 (
   blat -server %SERVER% -f %FROMNAME% -u %USER% -pw %PW% -to %TO% -subject %ONLINE2% -body "%DATE% - %TIME%"
   set /a MINER2_CTR=1
   )
goto :STARTPING3

:MINER2OFFLINE

if %MINER2_CTR% gtr 2 goto :WAIT
blat -server %SERVER% -f %FROMNAME% -u %USER% -pw %PW% -to %TO% -subject %SUBJECT2% -body "%DATE% - %TIME%"
set /a MINER2_CTR+=1

:STARTPING3
PING -n 1 %IPV4_MINER3%
PING -n 1 %IPV4_MINER3%|find "TTL" >NUL
IF     ERRORLEVEL 1 goto :MINER3OFFLINE
IF %MINER2_CTR% NEQ 1 (
   blat -server %SERVER% -f %FROMNAME% -u %USER% -pw %PW% -to %TO% -subject %ONLINE3% -body "%DATE% - %TIME%"
   set /a MINER3_CTR=1
   )
goto :STARTPING4

:MINER3OFFLINE

if %MINER3_CTR% gtr 2 goto :WAIT
blat -server %SERVER% -f %FROMNAME% -u %USER% -pw %PW% -to %TO% -subject %SUBJECT3% -body "%DATE% - %TIME%"
set /a MINER3_CTR+=1

:STARTPING4

:WAIT

rem ** Wait 10 minutes and try again.
timeout /t 600
goto :STARTPING1