Software

How to Restart a BAT file on Windows at an Interval

[ad_1]

I recently wrote a .bat script on Windows to mine Ethereum when I’m not using my gaming PC to frag noobs. I have a friend who also tries to mine cryptocurrencies but their machines have AMD processors; every once in a while, the processor and the mining executable start fighting and all mining comes to a halt.

Having the mining .exe stop work but not kill the process is a really frustrating problem. I thought it was a Windows sleep/hibernation issue but the solution I wrote about in that post didn’t fix the problem. I went with the next best solution: killing and restarting the process after a given amount of time:

:loop
start PhoenixMiner.exe -pool us1.ethermine.org:4444 -pool2 us1.ethermine.org:4444 -wal WALLET_ADDRESS -proto 3
echo "-------------------------------MINER STARTED"
timeout /t 3600 >null
echo "-------------------------------MINER TERMINATED, RESTARTING"
taskkill /f /im "PhoenixMiner.exe" > null
goto loop

This script kills the process and restarts it after an hour, regardless of if mining is running smoothly or has quit. This obviously isn’t a perfect solution; a better answer would be to create a script to listen for an error and restart the process immediately. I will contend it’s a workable solution so that mining isn’t down for an entire night!

  • Responsive Images: The Ultimate Guide

    Chances are that any Web designers using our Ghostlab browser testing app, which allows seamless testing across all devices simultaneously, will have worked with responsive design in some shape or form. And as today’s websites and devices become ever more varied, a plethora of responsive images…

  • Being a Dev Dad

    I get asked loads of questions every day but I’m always surprised that they’re rarely questions about code or even tech — many of the questions I get are more about non-dev stuff like what my office is like, what software I use, and oftentimes…


[ad_2]
Source link
Show More

admin

Makes Noise is a blog where you can find all the juicy details on a variety of topics including health and fitness, technology, lifestyle, entertainment, love and relationships, beauty and makeup, sports and so much more. The blog is updated regularly to make sure you have all the latest and greatest information on the topics that matter most to you.

Related Articles

Leave a Reply

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

Back to top button