How to remotely start/stop Antminer S9, Antminer L3+ and probably others

PLEASE NOTE: This is probably not the best way of doing the thing but it is ONE way of doing it, which has been working for me. If you have a better way please let me know 🙂

if you log into your miner via ssh and look in /etc/init.d/ you should see the script file which runs the mining dameon/program.

On the s9 it’s called bmminer.sh and on the L3+ it’s cgminer.sh. I guess it’ll be similar on other miners. If you have a different miner and want to find out what script to look for just do “top” at the ssh console and see what processes are hogging the most resources. On the S9 it’s a process called bmminer, and in the /etc/init.d/ folder there’s bmminer.sh to run the service.

You can start and stop the mining service with:

on S9:
/etc/init.d/bmminer.sh stop
on L3+
/etc/init.d/cgminer.sh stop

(or use with “start” or “restart” as needed). You can read the contents of the script with:

S9:
cat /etc/init.d/bmminer.sh

or

L3+:
cat /etc/init.d/cgminer.sh

I’ve noticed that occasionally the service won’t start properly, if you find you have the same and end up deciding not to trust starting and stopping the services to be reliable, you could just use the command above to stop the service (which seems to always work and is easily verifiable) and then restart the mining by initiating a reboot “reboot” command over ssh.. which will give you a clean start.

I’m 99% certain you aren’t invalidating any warranty with this. If anyone knows otherwise please let me know.

As far as I’m aware you’re not changing any files You’re just logging in via ssh (which iirc they tell you how to do) and then using the daemon they install on the system from the factory using the commands the system uses to start up already.

Be patient with the S9 – mine takes about 7-8 mins to restart the service. So far the L3 seems to have no problem starting and stopping, but whilst the S9 stops mining ok, it seems to prefer a reboot to start mining again.

The fans keep going all the while so there’s no let up of noise unfortunately but you can stop things overheating if it’s looking a bit too hot, without having to muck about with mains switches which may be in inconvenient locations.

I’m using this setup in conjunction with a raspberry pi zero and a temper module (see previous posts) with a bit of php/bash/remote-ssh shenanigans to automatically switch my miners off once their cab temp reaches a certain temp threshold and restart them again once the temp drops back below a threshold.  Will post the code once it’s fully working/reliable if anyone else needs it – post in comments if so.

To be continued…

Leave a Reply