Bitcoin Forum

Bitcoin => Mining support => Topic started by: DordOfLarkness on June 30, 2019, 05:02:25 PM



Title: basic cgminer commands via SSH: display miner status?
Post by: DordOfLarkness on June 30, 2019, 05:02:25 PM
Greetings.  I've been enjoying using cgminer with my Avalon 841.
While, yes, I can log into my Openwrt server via the web client, I've been preferring to start/stop the miner via SSH and a terminal window.  (Which I now have an automated command set up on my phone that I can even use Siri to start or stop the miner by just saying "miner stop" or "miner start". Kinda stupid, but so am I.)

One thing I haven't figured out is how to get the status of the miner via SSH.  Yes, I know I can get the info via the web client...even remotely.  I'm just curious if this is possible via SSH.

Available commands:

Code:
	start	Start the service
stop Stop the service
restart Restart the service
reload Reload configuration files (or restart if that fails)
enable Enable service autostart
disable Disable service autostart

I would think there would be a "status" command or something.  Looking in the readme, I find some neat options (-V to see the version and -n to see what's connected via USB) but nothing that tells me if it's running and what pool it's connected to...  I'm sure I'm missing something very basic...

Thanks!



Also noticing that -V and -n work when calling cgminer from the root directory:

Code:
root@OpenWrt:~# cgminer -V
cgminer 4.10.0

they don't work when calling them from /etc/init.d/cgminer

Code:
root@OpenWrt:~# /etc/init.d/cgminer -V
Syntax: /etc/init.d/cgminer [command]

Available commands:
start Start the service
stop Stop the service
restart Restart the service
reload Reload configuration files (or restart if that fails)
enable Enable service autostart
disable Disable service autostart

Obviously, there are some extremely basic Linux/Openwrt concepts I'm missing here and I'm probably playing with fire somewhat haha.


Title: Re: basic cgminer commands via SSH: display miner status?
Post by: Artemis3 on July 02, 2019, 11:07:12 PM
Indeed, what you are confusing is the script ("batch" in ms parlance) file to start the cgminer "service" (they are called "daemons" in *nix) with the actual cgminer binary. You ran the actual cgminer binary when you did that -V command option, so do that again with -h or --help to find out what commands cgminer accepts. Presumably that binary is located in /usr/bin, i don't have an avalon to find out, but you don't need the full path like you do when calling the script that calls cgminer, because the binary, as opposed to the script that calls it at boot, is in the system path already.

Do note that there is usually a cgminer instance running already, to stop it you would use that "service" script, like: /etc/init.d/cgminer stop then issue the commands to cgminer directly to see/test what options you want, once settled you could modify the starting script. BUT, cgminer also reads its own configuration file, which should be in /etc/cgminer.conf or similar.

You can read the actual documentation here (https://github.com/ckolivas/cgminer),  but asic manufacturers often modify and add their own options which might not be shown there.

The developer is an active moderator in this board (-ck (https://bitcointalk.org/index.php?action=profile;u=19971)). I don't know the story but i think he got bored with it or something and its not maintained much lately.


Title: Re: basic cgminer commands via SSH: display miner status?
Post by: PassThePopcorn on July 03, 2019, 01:48:36 PM
Hit cgminer-api for the Avalons.
So something like

Code:
cgminer-api stats

You can also read the cgminer repo to get some examples of connecting to the api without sshing in. These examples are "api-example.(language file)"

This repo is the Canaan Creative repo, they push it to the main repo Artemis3 posted but it's updated quicker on theirs.
https://github.com/Canaan-Creative/cgminer


Title: Re: basic cgminer commands via SSH: display miner status?
Post by: DordOfLarkness on July 03, 2019, 05:20:12 PM
Great! Makes sense.    Thanks for the hot tips, the info, and the links.  Woo hoo!

I'll drop back in if I have further questions.

Really appreciate it!   :D :D :D