1

I am running xmrig-5.8.1 on Ubuntu 18.04 by executing this cmd ./xmrig --donate-level 1 -o pool.supportxmr.com:xyz -u MY-XMR-ADDRES -p Rig1 -k --tls. Now I want it to start automatically in background whenever I start my system. I found some way like adding a script file inside init or init.d folder but I don't know how to add the script file inside these folder and what to add inside these script file?

jtgrassie
  • 19,601
  • 4
  • 17
  • 54
zircon
  • 151
  • 2
  • 8

1 Answers1

4

There are many ways to do this. One simple way is via cron:

In a shell execute crontab -e then add and edit the line:

@reboot /path/to/xmrig -B [--syslog | --log-file=/some/file.log] [your other options] 

Save and exit.

The -B option runs it in the background and you add either the --syslog or --log-file option so you can get at its output.

Many other Ubuntu examples of running things at startup here: https://askubuntu.com/questions/814/how-to-run-scripts-on-start-up

jtgrassie
  • 19,601
  • 4
  • 17
  • 54