cryptonote-social / csminer

csminer Monero miner from https://cryptonote.social/
GNU General Public License v3.0
58 stars 24 forks source link

add non-interactive mode so csminer can run using systemd autostart #13

Open ghost opened 1 year ago

ghost commented 1 year ago

This might be a dumb question, but how create a systemd-unit file for csminer? I want to make csminer run automatically on every boot.

I am trying this:

[Unit]
Description=csminer
After=network.target

[Service]
ExecStart=/<dir>/csminer -user=<user>

But I get an error on startup:

ERROR(miner.go,171): Scanning terminated
FATAL(csminer.go,134): Miner failed: didn't expect keyboard scanning to terminate

Apparently, csminer expects to be launched from the terminal, where you can send commands. But it doesn't seem to happen when running through systemd.

cryptonote-social commented 1 year ago

Hmm actually it's a very good question. csminer was designed for its interactive features so it expects keyboard input, and I guess running it non-interactively as a startup script confuses it. It should be easy to add a non-interactive mode, but I guess I figured most folks who require such a feature might prefer to use xmrig. I'll leave this issue open and consider it a feature request. There may also be some unix utility that fools it into believing keyboard scanning is active, but don't know of anything off the top of my head.

kkarhan commented 1 year ago

Personally, I think a non-interactive use should be enabled and supported, at least according to the arguments found in the README.txt included in the shipped version.

Re: systemd services: every executeable / shell script can be turned into a systemd service easily. https://linuxhandbook.com/create-systemd-services/

kkarhan commented 1 year ago

A potential solution to the whole "unattended use" case would be to work with a config file. For example xmrig uses a config.json file that can be easily customized with a web assistant.

Tho for some reason neither it nor csminer seem to accept donation percentages < 1 [%], and instead ignore values like 0.1337 [0,1337%] or 0.42069 [0,42069%], which is sad cuz someone may be more tempted to choose 0,1%, 0,01% or even 0,001% if that was possible instead of >1% [or 0,5% in csminer] and 0%...

After all, even the smallest amount counts...

cryptonote-social commented 1 year ago

You definitely can leave donation percentages less than 1 %....

./csminer -tls -config="donate=.001" -user=someuser -wallet=44SqRf9gxV....

Tagging the request to add non-interactive mode as enhancement request.

kkarhan commented 1 year ago

I guess with the shutdown of cryptonote.social's Monero pool this point is kinda moot now.

Still good to see that miners get paid out tho.