Skip to content

Instantly share code, notes, and snippets.

@bnjdg
Last active September 19, 2021 10:15
Show Gist options
  • Save bnjdg/f5149b64ff9cbce2ca3ca9e5b14b4c57 to your computer and use it in GitHub Desktop.
Save bnjdg/f5149b64ff9cbce2ca3ca9e5b14b4c57 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'
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