Bitcoin Forum
April 25, 2024, 12:55:20 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: batchfile to restart cgminer in Windows, if a card dies  (Read 4911 times)
FiatKiller (OP)
Sr. Member
****
Offline Offline

Activity: 378
Merit: 250


View Profile
May 28, 2013, 06:32:59 PM
Last edit: May 29, 2013, 03:07:01 PM by FiatKiller
 #1

I have not actually HAD a card die since I got this going, but I'm 99% certain it will work.
I did alot of research on various aspects of batchfile functions to piece this together.
I know the cgwatcher program can do this, but this is simpler.

There are five steps:

1) Make a file in your cgminer directory called INPUT.txt with FILE=<name of cgminer batchfile> in it.

2) Put this line in all your various cg batchfiles: ECHO FILE=<name of cgminer batchfile> > INPUT.txt

3) Put the following into any batchfile name you want: (I use CG_Kill.bat)

REM Requires cgminer to be run with 2>Log.txt parameter AFTER
REM starting this batchfile.
REM Requires statement of FILE=<name of cgminer batchfile>
REM in a file called INPUT.txt
REM Also, in all your different cgminer batchfiles, put a
REM line to ECHO it's name to the input file like:
REM ECHO FILE=cg.bat > INPUT.txt

DEL Log.txt
SET /A COUNT=0

:LOOP
SET /A COUNT+=1
REM get name of current cgminer batchfile
for /f "delims=" %%x in (INPUT.txt) do (set "%%x")

REM check for dead card and restart cgminer, if so...
FINDSTR /m "DEAD" Log.txt
if %errorlevel%==0 (
Taskkill /IM cgminer.exe /F
TIMEOUT 10
ECHO %DATE% >> RESTARTS.txt
ECHO %TIME% >> RESTARTS.txt
DEL Log.txt
REM insert name of cgminer start batchfile after this line
START CALL %FILE%
)

REM Deletes Logfile every hour so that searching it is quick enough.
IF "%COUNT%" == "30" (
Taskkill /IM cgminer.exe /F
TIMEOUT 10
DEL Log.txt
SET /A COUNT=0
REM insert name of cgminer start batchfile after this line
START CALL %FILE%
)

REM wait two minutes to recheck for dead card
TIMEOUT 120

GOTO LOOP

4) Requires cgminer to be run with 2>Log.txt parameter AFTER
starting this batchfile.

5) Add an EXIT command after the cgminer command to your cg batchfiles. (prevent multiple open windows)
So, if your cg batchfile was coinpool.bat you would have this in it:

ECHO FILE=coinpool.bat > INPUT.txt
cgminer blah blah <parameters> 2>Log.txt
EXIT

Note: it will restart cgminer once an hour as part of the process of not letting the logfile get too big.

LTC: LdxgJQLUdr8hZ79BV5AYbxkBUdaXctXAPi
MoonCoin Gambling: https://coin-horse.com/MON/
1714049720
Hero Member
*
Offline Offline

Posts: 1714049720

View Profile Personal Message (Offline)

Ignore
1714049720
Reply with quote  #2

1714049720
Report to moderator
1714049720
Hero Member
*
Offline Offline

Posts: 1714049720

View Profile Personal Message (Offline)

Ignore
1714049720
Reply with quote  #2

1714049720
Report to moderator
1714049720
Hero Member
*
Offline Offline

Posts: 1714049720

View Profile Personal Message (Offline)

Ignore
1714049720
Reply with quote  #2

1714049720
Report to moderator
Even in the event that an attacker gains more than 50% of the network's computational power, only transactions sent by the attacker could be reversed or double-spent. The network would not be destroyed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
FiatKiller (OP)
Sr. Member
****
Offline Offline

Activity: 378
Merit: 250


View Profile
May 29, 2013, 10:56:46 AM
 #2

Thanks, I may check it out. Once this bat code is tweaked & confirmed - I think it's simpler to use
& definitely "open source"  lol

LTC: LdxgJQLUdr8hZ79BV5AYbxkBUdaXctXAPi
MoonCoin Gambling: https://coin-horse.com/MON/
qiuness
Hero Member
*****
Offline Offline

Activity: 714
Merit: 500



View Profile
June 09, 2013, 08:42:12 PM
 #3

what if CGMiner dies, will it restart it?
FiatKiller (OP)
Sr. Member
****
Offline Offline

Activity: 378
Merit: 250


View Profile
June 10, 2013, 12:26:24 PM
 #4

Absolutely. It records the timedate stamp of when this happens, and worked for me twice so far.
I did decide to search for the word "SICK" and not DEAD to catch problems quicker. But you can
search for loss of connection also. The other good thing is that once your batchfiles are all set-up
correctly, you can leave CG_Kill running and switch to another cg batchfile because it reads the name
of what file to restart on every cycle. I'm very pleased with it.

LTC: LdxgJQLUdr8hZ79BV5AYbxkBUdaXctXAPi
MoonCoin Gambling: https://coin-horse.com/MON/
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!