Ok, I have been setting up my <a href="http://cubieboard.org/">CubieTruck</a> up with <a href="https://fedoraproject.org/">Fedora</a> to be able to control my <a href="http://www.butterflylabs.com/">Butterflylabs</a> hardware.

Obviously, I had to compile cgminer, which is straightforward; as mentioned <a href="http://blog.woralelandia.com/2013/10/11/howto-butterfly-labs-bitforce-2530-ghs-miner-in-fedora/" title="HowTo: Butterfly Labs BitForce 25/30 GH/s Miner in Fedora 19">here</a>.

So, I want the CubieTruck to start <a href="https://github.com/ckolivas/cgminer">cgminer</a>, automatically, as a <a href="http://freedesktop.org/wiki/Software/systemd/">systemd</a> process.

I need a service unit:

# /etc/systemd/system/cgminer.service
[Unit]
Description=Start mining bitcoin
After=syslog.target network.target nss-lookup.target

[Service]
Type=forking
ExecStart=/usr/local/bin/cgminer --syslog --real-quiet -o stratum+tcp://stratum.mining.eligius.st:3334 -u 1K7FEkbvBtMvtyT7S3RrPjuqWuJWfgUZBa -p somepassword -l 9

[Install]
WantedBy=multi-user.target

And there it is! Next, just activate it to start on boot and start it:

su -c 'systemctl enable cgminer.service'
sy -c 'systemctl start cgminer.service'

If you wanna check out the output of cgminer; which is a lot, btw, you need journalctl:

su -c 'journalctl -u cgminer -f'

I recommend setting some sane limits on your journalctl.conf file:

# /etc/systemd/journald.conf
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# See journald.conf(5) for details

[Journal]
#Storage=auto
Compress=yes
#Seal=yes
#SplitMode=login
#SyncIntervalSec=5m
#RateLimitInterval=30s
#RateLimitBurst=1000
SystemMaxUse=100M
#SystemKeepFree=
SystemMaxFileSize=20M
RuntimeMaxUse=100M
#RuntimeKeepFree=
RuntimeMaxFileSize=20M
#MaxRetentionSec=
#MaxFileSec=1month
#ForwardToSyslog=yes
#ForwardToKMsg=no
#ForwardToConsole=no
#TTYPath=/dev/console
#MaxLevelStore=debug
#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info

Now, I am no guru or anything like that. I might've missed some stuff. Keep the feedback coming, dudesses and dudes!