A miner that stops at 2am and stays stopped until you notice the next morning has wasted hours of work. A watchdog fixes that: it watches the miner process and restarts it the moment it dies. This guide covers a simple, dependable setup on both Windows and Linux.

Why miners stop in the first place

The usual culprits are network blips, a power-saving sleep event, a driver hiccup, or an overnight router reboot. Most are transient. The miner could happily continue if something simply relaunched it. That something is your watchdog.

Windows option 1: a restart loop script

Create a small batch file that launches the miner inside a loop. When the miner exits for any reason, the loop waits a few seconds and starts it again:

  • Write :loop, then the line that runs your miner executable, then timeout /t 10, then goto loop.
  • Save it as run-miner.bat and launch the miner through this file instead of directly.

Windows option 2: Task Scheduler at login

Open Task Scheduler, create a task that runs your run-miner.bat at user logon, and enable the option to restart the task if it fails. This also handles the case where the whole PC reboots - the miner comes back automatically once you are logged in.

Linux option: a systemd service

Systemd has restart-on-failure built in. Create a unit file that runs your miner, set Restart=always and a short RestartSec=10, then enable the service so it starts on boot. Systemd will relaunch the miner after crashes and after reboots without any scripting.

Add a hashrate watchdog (optional but smart)

A process can be alive but stuck producing zero hashrate. Many miners support an internal watchdog setting that restarts the miner if hashrate drops to zero for a set period. Enable it in the config if available. If not, a short script that checks the log for recent share accepted lines and kills a silent miner achieves the same thing.

Test it before you trust it

  • Manually kill the miner and confirm it relaunches within your timeout.
  • Reboot the PC and confirm the miner returns on its own.
  • Unplug the network briefly and confirm it reconnects or restarts cleanly.

Keep it quiet but logged

Redirect the miner output to a log file so you can review what happened overnight. A watchdog that restarts silently is good; one that also leaves a trail is better for spotting a recurring problem.