Configure and run xmrig in linux
Create the below service
file at /etc/systemd/system/
, if you're using debian
.
[Unit]
Description = xmrig
After = network.target
[Service]
Type = simple
User = root
Group = root
LimitNOFILE = 4096
Restart = always
RestartSec = 5s
StartLimitIntervalSec=300 # Restart counter resets after 5 minutes
StartLimitBurst = 30 # Maximum 30 restarts within 5 minutes
StandardOutput = /home/ramit/custom_logs/xmrig.log # For stdout
StandardError = /home/ramit/custom_logs/xmrig.err.log # For stderr (optional)
ExecStart = /home/ramit/projects/xmrig/build/xmrig
[Install]
WantedBy = multi-user.target
sudo systemctl daemon-reload
sudo systemctl start xmrig.service
sudo systemctl status xmrig.service
sudo systemctl enable xmrig.service
Create a config file /root/.xmrig.json
. This config file will have the xmrig options which will be used when the miner is executed.
By default, xmrig
looks for the config file at the following locations:
- look for
config.json
in the xmrig build directory,xmrig/build/config.json
/root/.xmrig.json
/root/.config/xmrig.json
You can create the file at any of the above locations.