Miner in the background
Coll147 opened this issue · comments
How could I leave the miner in the background so that it continues mining after closing the terminal?
Hi @Coll147,
Are you using a GUI or CLI OS whilst running this program?
I'm using rpios lite (cli), although I was able to do it in the end with a service. Here I share the file I made:
[Unit]
Description= Monero Miner
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/home/aaron/xmrig/build/xmrig -o gulf.moneroocean.stream:10128
-u 491pX3z7pdeixRPPJWBK7KZ6hPysWEw3nj36A7YBTtAQ4Es5bWoVvNSU7KNhcuxB6x6ZT4Wg3hcHPMax4KwRnG2Q3uQb3FX-p pi4
WorkingDirectory=/home/aaron/xmrig/build
Restart=always
RestartSec=20
[Install]
WantedBy=multi-user.target
I hope it can help others who have a question similar to the one I had.
Hi @Coll147,
To run xmrig
in the background on your Raspberry Pi, you can use the &
symbol at the end of the command, or you can use the nohup
command. Here are both methods:
Method 1: Using the &
symbol
-
Open a terminal window on your Raspberry Pi.
-
Navigate to the directory where
xmrig
is located. Based on your provided script, it appears to be in the/home/aaron/xmrig/build/
directory. -
Run
xmrig
in the background using the&
symbol and specify your mining parameters as needed:./xmrig -o gulf.moneroocean.stream:80 -u 4657q4dnsjLWtzeW4XN3wG9swFumWAZB9i1pegTLMxVAQy5E5AE8uif42kkHWcWc9vDcLUmzeCf3pV7mmrJQQqqe84dtASi -p Raspberry-Pi &
This command will start
xmrig
in the background, and you will get your terminal prompt back.
Method 2: Using nohup
-
Open a terminal window on your Raspberry Pi.
-
Navigate to the directory where
xmrig
is located. Based on your provided script, it appears to be in the/home/aaron/xmrig/build/
directory. -
Run
xmrig
in the background using thenohup
command:nohup ./xmrig -o gulf.moneroocean.stream:80 -u 4657q4dnsjLWtzeW4XN3wG9swFumWAZB9i1pegTLMxVAQy5E5AE8uif42kkHWcWc9vDcLUmzeCf3pV7mmrJQQqqe84dtASi -p Raspberry-Pi &
This command will start
xmrig
in the background and detach it from the terminal. It will also redirect the output to a file namednohup.out
in the same directory.
After using either method, xmrig
will continue running in the background, allowing you to use the terminal for other tasks. You can check the mining progress and view logs as needed.
If these methods do not work, re-open this issue.
Thanks, Najm