[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