Skip to content

Instantly share code, notes, and snippets.

@wechain
Forked from bnjdg/README.md
Last active September 24, 2021 04:08
Show Gist options
  • Save wechain/b096ccf147e8f9066c1f8ecdbae1d874 to your computer and use it in GitHub Desktop.
Save wechain/b096ccf147e8f9066c1f8ecdbae1d874 to your computer and use it in GitHub Desktop.
XMRig tmux systemd service files

##Installation

Build XMRig according to build instructions: https://github.com/xmrig/xmrig/wiki/Ubuntu-Build

Copy the respective service files to /etc/systemd/system/

Reload the systemd daemon:

# systemctl daemon-reload

Enable the service:

# systemctl enable xmrig

Start the service:

# systemctl start xmrig

to access the tmux session:

# tmux a -t xmrig

detach from the session: Press Ctrl-B and D or tmux-prefix D

replace the word xmrig with xmrig-proxy for the proxy

[Unit]
Description=xmrig-proxy on tmux
[Service]
WorkingDirectory=/opt/xmrig-proxy/build/
User=root
Type=forking
ExecStart=/usr/bin/tmux new-session -s xmrig-proxy -d '/opt/xmrig-proxy/build/xmrig-proxy'
ExecStop=/usr/bin/tmux send-keys -t xmrig-proxy:0.0 C-c C-c
ExecStop=/bin/sleep 2
[Install]
WantedBy=multi-user.target
[Unit]
Description=xmrig on tmux
[Service]
WorkingDirectory=/opt/xmrig/build/
User=root
Type=forking
ExecStart=/usr/bin/tmux new-session -s xmrig -d '/opt/xmrig/build/xmrig --config=/root/.xmrig.json'
ExecStop=/usr/bin/tmux send-keys -t xmrig:0.0 C-c C-c
ExecStop=/bin/sleep 2
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment