/etc/rc.local for autostart,
/usr/local/bin/miner-launcher.sh as a generic launcher you will invoke if you ever need to restart your miner.
/usr/local/bin/startcgminer.sh for launching cgminer. Cgminer technicalities belong here.
/etc/rc.local should include this line, let's keep it clean:
The ampersand returns control to rc.local at once, without waiting for the whole minute until miner-launcher is done with its work.
/usr/local/bin/miner-launcher.sh might look something like that:
DEFAULT_DELAY=0
if [ "x$1" = "x" -o "x$1" = "xnone" ]; then
DELAY=$DEFAULT_DELAY
else
DELAY=$1
fi
sleep $DELAY
screen -dmS cgm su your_user_name -c "/usr/local/bin/startcgminer.sh" #this will run your miner as a specified user, you need to replace your_user_name with an actual username
# if you have no issue with cgminer running as root by default, comment out the above line and uncomment the one below:
#screen -dmS cgm /usr/local/bin/startcgminer.sh
/usr/local/bin/startcgminer.sh is a good place for the implementation details:
export DISPLAY=:0
export GPU_USE_SYNC_OBJECTS=1
cd /home/your_user_name/BTC/cgminer # avoid using relative paths in scripts, this will save you a lot of headache. You need to replace your_user_name with an actual username
./cgminer
# or perhaps ./cgminer 2> cgminer.log #cgminer output is being logged to cgminer.log
You need to make /usr/local/bin/miner-launcher.sh and /usr/local/bin/startcgminer.sh executable:
chmod +x /usr/local/bin/*miner*.sh
Make sure the files are owned by root (it's insecure to have user-writable executable files in system directories):
chown root:root /usr/local/bin/*miner*.sh
When you kill cgminer, simply invoking miner-launcher.sh will launch a fresh instance of screen for you and execute your favorite miner inside.
Since the -m argument is passed to screen, screen will die together with cgminer.
Am I forgetting something?? Uhmmm... don't think so.
Will this work as is, without any additional tinkering or debugging? This better work or else