Simple Script to Restart your Miner Software After a Given Period of Time

19 Jun
2014

miner-restart-script-windows

There were some people asking for a simple solution to automate the process of restarting a miner software every few hours in order to be sure that it is working fine under Windows OS. The below Batch file code example offers a simple and easy way to do that and it uses sandor’s fork of cpuminer for Gridseed Scrypt ASICs as an example. You need to set the parameters based on the miner and command line you use as well as the time after which the miner process will be killed (default 4 hours), then the script will wait for 10 seconds and start the miner again. There is also a counter to show you the number of restarts that have been executed since you’ve started the Batch script.

@echo off

echo -------------------------------------------------------------------
echo Simple script to restart your miner software after a period of time
echo -------------------------------------------------------------------
echo:

set executable=minerd.exe
set commandline=--freq=1150 --gc3355=\\.\COM1 --url=stratum+tcp://eu2.multipool.us:7777 --userpass=yourworker.1:password
set runforseconds=14400
set restartinseconds=10
set /a counter=0

:start
start "Miner Window" %executable% %commandline%
echo:
echo The software will run for %runforseconds% seconds
timeout %runforseconds%
taskkill /f /im %executable%
echo:
echo Restarting the software in %restartinseconds% seconds (%counter%)
timeout %restartinseconds%
set /a counter+=1
echo:
echo:
goto start

In order to use the code above you just have to copy it and save as a .BAT file as well as to modify some of the variables as per your needs and requirements and then run it. Do note that you will get two program windows, one that will have the Batch script running and another for the miner software. You should not close the windows with the script running as this will stop the execution of the script immediately and the miner software will not be restarted anymore.



Other Similar Publications:

9 Responses to Simple Script to Restart your Miner Software After a Given Period of Time

Will

June 20th, 2014 at 11:13

I was having issues on windows with the blades. One blade after an hr or two will drop then the other will follow, the software still runs and gets work etc but blades dish out nothing, no hw errors even… I added –gc3355-timeout=120 to the bat file and so far 3 days with no messing about…… I believe it restarts the miner if no share has been submitted for over 120 seconds.. you can change the settings as desired. Mixed with the above code from the blog, happy days :)

Charlie

June 20th, 2014 at 14:14

could this work for other mining programs as well. Specifically cudaminer?

admin

June 20th, 2014 at 15:45

Charlie, it can work for any program, you just have to set the name of the executable file and the command line options and you are ready to go.

BountyBob

June 20th, 2014 at 18:31

Hi, thanks for that script :)

i’m having a problem on cudamier/ccminer: the miner process is not killed after the countdown for some reason (i then have multiple processes)
here are the only modifications i did on ccminer:

set executable=ccminer30.exe
set commandline=-a x11 -o stratum+tcp://drkpool.com:3333 -u [myUserName].1 -p x

same with cudaminer:

set executable=cudaminer
set commandline=-a keccak -i 1 -l K10x28 -C 1 -m 1 -H 1 --url stratum+tcp://erebor.dwarfpool.com:3339 -u [myUserName].1 -p x

i’m showing those 2 command lines that work on their own of course ([myUserName] replaced by the right one)

admin

June 21st, 2014 at 00:12

BountyBob, make sure you set the full executable file name, including the .exe

Just tested the script with ccminer and it works just fine here.

BountyBob

June 21st, 2014 at 14:28

i checked but rather than “SUCCESS: The process “ccminer.exe” has been terminated”
i get an “ERROR: Not enough storage is available to complete this operation.”

it might be my antivirus preventing the script to kill another process i use comodo on win7 64

i’ll figure it out, thanks anyways admin :p

admin

June 21st, 2014 at 15:26

Could be, it is a strange error message that you are getting for sure.

BountyBob

June 22nd, 2014 at 01:50

all right after a few more tests i just had the confirmation: the “taskkill” command is indeed prevented by some antivirus/firewall without telling you or sending you feedback … it’s like a silent sandbox default mode

How to test is you are in this situation?
make a “restartScriptTest.bat” with your settings and “runforseconds=10” and check if the first “Miner Window” is killed before a second one pops

How to fix ?
1. create your new “restartScript.bat”, launch it then close it (and the “Miner Window”) to make the antivirus aware of that brand new .bat
2. go to your antivirus “File rating” section and in “Unrecognized Files” sort them by date to find your “restartScript.bat” at the top
3. right click it and “Add to > Trusted Files”
4. relaunch your “restartScript.bat” then authorize internet access (use runforseconds=10 to test if it kills “Miner Window” before making a new one)
5. set back your runforseconds to a few hours and you are done :)

sorry for extra detailed explanations but it might help some :p

i just had my well deserved “SUCCESS”

loszhor

July 30th, 2014 at 10:37

Thank you SO MUCH for this. My miners loss efficiency after about half an hour to an hour and I’ve been going crazy attempting do something like this without having to rely on extra API programs. Thanks again!

Leave a Reply

Your email address will not be published. Required fields are marked *

top