Author

Topic: Headless Miner - cgminer issue (Ubuntu 12.04) (Read 3743 times)

sr. member
Activity: 370
Merit: 250
Hey thanks for the serious answers. It helped out a lot, toss your BTC/LTC address my way for a tip
sr. member
Activity: 298
Merit: 250
Play2Live pre-sale starts on January 25th
Another thing, if its going to be a headless miner, you should probably create some auto startup scripts. I use something like the below:

Create a file called mine.sh in your home directory containing something like this:
Code:
#!/bin/sh
export DISPLAY=:0
export GPU_MAX_ALLOC_PERCENT=100
export GPU_USE_SYNC_OBJECTS=1
cd /[** insert path to cgminer director **]
./cgminer -o [mining pool url] -u [username] -p [password] [*insert all your cgminer options*]

Create a file called launch_miner.sh in your home directory containing something like this:
Code:
#!/bin/bash
DEFAULT_DELAY=0
if [ "x$1" = "x" -o "x$1" = "xnone" ]; then
   DELAY=$DEFAULT_DELAY
else
   DELAY=$1
fi
sleep $DELAY
su YOUR_USERNAME -c "screen -dmS cgm /[*insert path to home directory*]/mine.sh"

make sure launch_miner.sh is executable (chmod +x launch_miner.sh)

Then you can make it run automatically at startup:
sudo nano /etc/rc.local
and add this line above the line that says "exit 0":
Code:
/[*insert path to home directory*]/launch_miner.sh 30 &

And, add an alias to make it easy to check on cgminer...
sudo nano .bashrc
and add this line above the last section (that starts with "# enable program completion...")
Code:
alias cgm='screen -x cgm'

If you do this, and have auto login enabled on the miner, then whenever it starts up it will automatically start mining after a 30 second delay. If you ssh in to it, all you have to do is use the command cgm and you will be able to see cgminer.
Another recommendation, go into the bios of the machine and turn on the automatic power on after power loss. That way if the machine ever loses power, it will automatically come back on and start mining again.
sr. member
Activity: 298
Merit: 250
Play2Live pre-sale starts on January 25th
Yes, X has to be running and you should run these two commands before you start cgminer via ssh:

export DISPLAY=:0
xhost +
legendary
Activity: 3583
Merit: 1094
Think for yourself
Funny thing about GPU's, they need a GUI.
sr. member
Activity: 370
Merit: 250
I can connect a keyboard/mouse and boot the system to the desktop, start cgminer and everything works.

If I reboot and connect via ssh when I try to start cgminer it complains that no adapters are available.

Has anyone had this issue? Do I have to initialize X before starting cgminer?
Jump to: