Skip to content

Instantly share code, notes, and snippets.

@akostadinov
Last active May 14, 2021 07:35
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akostadinov/55e907b1e20d4b7700fa7b88791a82ae to your computer and use it in GitHub Desktop.
Save akostadinov/55e907b1e20d4b7700fa7b88791a82ae to your computer and use it in GitHub Desktop.
Example xmr-stak systemd service unit file.
[Unit]
Description=xmr-stak miner
After=syslog.target network.target
[Service]
Type=simple
# interesting info about starting as regular user: https://bbs.archlinux.org/viewtopic.php?id=162297
User=username
LimitMEMLOCK=256M
EnvironmentFile=-/etc/sysconfig/xmr-stak
ExecStart=/path/xmr-stak/bin/xmr-stak --currency monero -o pool.example.com:3333 -u my_wallet -p x --config /path/xmr-stak/config.txt --cpu /path/xmr-stak/cpu.txt
Restart=always
RestartSec=30
[Install]
WantedBy=multi-user.target
# save this file in /etc/systemd/system/xmr-stak.service
# systemctl enable xmr-stak
# systemctl start xmr-stak
# note, xmr-stak executable must have selinux context unconfined_u:object_r:bin_t:s0
@semeion
Copy link

semeion commented Jul 14, 2018

Hello! What is that EnvironmentFile=-/etc/sysconfig/xmr-stak ? I don´t have this file and/or that directoy on my system.

BTW nice jobs on this systemd service, thanks!

@akostadinov
Copy link
Author

@semelon , you just create it with whatever environemnt variables you want you program to work with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment