r/NiceHash•
Emjp4

Nicehash miner scheduling

NHM

Hey all!

I had a need recently to set up my NH mining rigs to run on a schedule, so as to utilize my energy plan's "Free nights" benefits, to only mine during those hours.

I found that there wasn't much in the way of using the Nicehash miner with a schedule/timer, so I made my own, albeit, in a very rudimentary (in programming) way.

​

It goes like this:

First, this requires a browser extension that can run user-written JavaScript code.

Personally, I use User JavaScript and CSS

Navigate to your Nicehash dashboard (the one with the 'Start All Rigs' and 'Stop All Rigs' buttons)

Click your browser extension's icon, and click "Add New".. if your extension doesnt have this, then somewhere in it's config you should be able to add the Nicehash dashboard URL (https://www.nicehash.com/my/dashboard) to the config.

​

From there, I wrote some code on Codesandbox

Codesandbox is an environment for writing/practicing/sharing code..

The code: https://codesandbox.io/s/cold-https-1iwxq?file=/index.js

​

Copy the contents from this link into your browser extension's "JS/JavaScript" section.

Review the code yourself, I've added comments where you can make your own adjustments to:

  • adjust the start/stop times
  • make the miner run during the day *or* the night
  • change the frequency in which it checks to make the switch
  • an optional "FIRST_RUN_DELAY" that you can set to run the toggler immediately after that time, rather than waiting for the first interval

​

In order for this to work, you have to navigate directly to your dashboard page (you can confirm it's running by seeing "Interval started, running every XXX seconds" in the DevTools console (F12 on Windows), and the window/tab must remain open, otherwise the code is not running.

​

Cheers!

Posted Nov 8, 2021, 7:54 PM UTC

34
Spykwak•

Just use Windows task scheduler to start and kill the application by starting a command line file.

KISS

1
Emjp4OP•

This assumes all rigs are Windows, and would involve performing this step on each individual rig.

My approach is OS agnostic, and controls every rig that's running on NH miner in one config.

1
Spykwak•

Then just use crontab / cron if Unix based.

Again KISS

1
Emjp4OP•

👍

1