Post
Topic
Board Mining software (miners)
Re: Is there a tutorial for using screen to auto start cgminer?
by
kano
on 12/11/2011, 07:24:36 UTC
All I did was put "screen cgminer **************"    in my auto.sh file and it works so I can SSH into them.
Hmm - not enough.
You also at least need to export DISPLAY=:0 in front of cgminer - or better in a script that does at least this:

#!/bin/sh
export DISPLAY=:0
cd ? ? ? (this would be something like "cd ~/cgminer-2.0.8/" or "cd /home/ubuntu/cgminer-2.0.8/")
now="`date +%Y%m%d%H%M%S`"
./cgminer .... 2> run.$now.$$.log

and then to start it: "screen scriptname"
(don't forget to "chmod +x scriptname")

or if you want it to always restart if it crashes:

#!/bin/sh
export DISPLAY=:0
cd wherever (this would be something like "cd ~/cgminer-2.0.8/" or "cd /home/ubuntu/cgminer-2.0.8/")
while true ; do
 now="`date +%Y%m%d%H%M%S`"
 ./cgminer .... 2> run.$now.$$.log
 sleep 2
done

but thus has one minor danger that if it doesn't work - it will continually try every 2 seconds ...