Post
Topic
Board Mining
Re: Linux: running headless and automation
by
dukejer
on 14/06/2011, 13:49:13 UTC

Ya, 30 seconds is an awfully long time.

You could always use something like xwininfo to verify it's running.

For example, if this fails, you have no server running -

xwininfo -display :0 -root

Return on fail should be - "xwininfo: error: unable to open display ":0""
I think xset q could be used, too.

xset -display :0 q

I wouldn't fiddle with gdm - I only use a basic wm and want the minimal work requests to the video card.



Hi supa,

I made some changes to my btcminer_X.conf upstart scripts.  They will now check for X and start up automatically.

Original scripts      http://forum.bitcoin.org/index.php?topic=9239.0

cat /etc/init/btcminer_0.conf

description     "Start BTC Mining"
start on runlevel [2345]
stop on runlevel [!2345]
kill timeout 30
script
  LOGINUSER=ChangeToMyLoginUser
  export DISPLAY=:0
  TIMEOUT=30
  XPID=""
  while true
  do
    sleep 1
    TIMEOUT=`/usr/bin/expr ${TIMEOUT} - 1`
    test ${TIMEOUT} -lt  0 && {
      echo "X not running."
      exit 255
    }
   
    XPID=`/usr/bin/pgrep -f -x /usr/bin/X`
    test -z ${XPID} && continue
    exec /usr/bin/screen -dmS gpu0 su -c '/usr/local/bin/startminer.sh 0' ${LOGINUSER}
    exit 0
  done
end script


- Dukejer

Extra Bitcoins burning a hole in your pocket?  Send them to 19oQLN2v1auiGqBDFfxSDUfu8Ax6ooT6xs if you feel my posts help you.