How to let grin miner run in the server background?

I turned on SSH and after running grin miner for a while, it was always disconnected.
I donot know if there is a command to let grin miner run in the server background.

su - user -c “screen -S grinm -d -m firejail --seccomp /home/username/grin-miner/grin-miner”
or
su - user -c “screen -S grinm -d -m /home/username/grin-miner/grin-miner”
above: run as root from rc.local f.e.

or
simple screen:
screen -S grinm
cd ~/grin-miner/ ; ./grin-miner
put to background:
Ctrl-A D
reconnect with:
screen -r grinm
check:
screen -ls

root@abcde-1:~# su - user -c “screen -s grinm -d -m /home/abcde/grin-miner/grin-miner”

it appears:
su: invalid option – ‘d’

Please use “”. The screen command is between"". Please it’s better to start with simple usage before going with auto start.

  1. Ssh to server.

  2. start screen.
    $ screen -S screenname

  3. when in screen start miner.
    $ /bla/bla/grin-miner

  4. put screen to background.
    Ctrl-a d

  5. check.
    $ screen -ls

  6. attach screen.
    $ screen -r screenname

1 Like

Done!
successful!
Thank you very much!

Any advice on how to make grin-miner autostart using ‘screen’ utility when system boots?

My way to start at boot is:

Commandline:

  • su - LinuxUsername -c “screen -S grinm -d -m firejail --seccomp /home/LinuxUsername/Downloads/bminer/bminer -uri cuckaroo29://myMailname%40gmail%2Ecom%2FmyUsername:myPassword@eu-west-stratum.grinmint.com:3416”
  • It’s the bminer on EU Grinmint pool
  • absolute path …
  • it works without firejail, ‘firejail --seccomp’ part is not needed but I use it by default

Command is started from next shell:

  • /usr/local/bin/rc.start-at-boot.sh (shell script is called rc.start-at-boot.sh)

Shell rc.start-at-boot.sh looks like this and can be executed (chmod +x):

#!/bin/bash
su - LinuxUsername -c “screen -S grinm -d -m firejail --seccomp /home/LinuxUsername/Downloads/bminer/bminer -uri cuckaroo29://myMailname%40gmail%2Ecom%2FmyUsername:myPassword@eu-west-stratum.grinmint.com:3416”
exit 0

And the rc.local is used to trigger the rc.start-at-boot.sh at boot time (only two lines are listed, it’s longer …):

nvidia-smi
/usr/local/bin/ rc.start-at-boot.sh

I found a way that is much simpler.

You can just create the file /etc/rc.local and make it executable, then put this in it:

#!/bin/sh
screen -dmS grinminer /home/rabinovitch/grin-miner-v1.0.2/grin-miner

That’s all. ubuntu 18.04.