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.targetsudo systemctl daemon-reload
sudo systemctl start xmrig.servicesudo systemctl status xmrig.servicesudo systemctl enable xmrig.serviceCreate 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.jsonin 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.