So I have cgminer, it starts at startup, picks configuration from the file, background process with screen, and if it stops, it starts again.
/etc/systemd/system/cgminer.service
[Unit]
Description=cgminer
After=network.target ntp.service
[Service]
Type=forking
ExecStart=/usr/bin/screen -dmS cgminer /home/$USER/cgminer-4.9.2/cgminer --sharelog /home/$USER/cgminer.log -c /home/$USER/.cgminer/cgminer.conf
ExecStop=/usr/bin/screen -S cgminer -X quit
Restart=always
[Install]
WantedBy=multi-user.target
chmod 0644 /etc/systemd/system/cgminer.service
systemctl enable cgminer.service
BTC 1DCRu4pnnwtbUYRy1evVw7TzXGW8XMwMNc