Author

Topic: Need CGMiner Help please (how to automate it) (Read 3726 times)

legendary
Activity: 952
Merit: 1000
September 07, 2012, 09:42:47 AM
#6
@crazyates

is this also true - not only for engine, memory, fan etc - but also for pool adress - username and password? (is it saved, too? so "./cgminer" is enough?)

Mostly yes, with one very important no. It writes all your settings for engine, memory, fan, voltages, kernel, vectors, worksize, temperatures, and most pool settings. You need to go into the config and manually add your pool passwords. You can also add more than one pool into the config file, and it uses them as backup.
hero member
Activity: 651
Merit: 501
My PGP Key: 92C7689C
September 07, 2012, 09:29:50 AM
#5
I don't know if I can understand how and where you edit this stuff... and I'm still guessing how I can autostart CGminer exactly with my account details etc... but I think I'll get it done)

I use Gentoo, so I have /etc/local.d/miner.start call the script given above with this:

Code:
su - salfter -c /home/salfter/start-miner.sh

With /etc/init.d/local set to run in the default runlevel, it fires up on boot.  bitcoind and p2pool can take a minute and a half to get going if they were shut down recently; if it's been down a while, it can take longer than that while bitcoind catches up with the blockchain.

I couldn't say what facility Ubuntu provides for running stuff at boot; I've never used it long enough to need to figure that out.

A couple more things about my script:

  • The script depends on a couple of tools you may or may not have installed: screen and netcat.  screen allows programs to run while detached from a terminal; netcat is used to ping the ports on which bitcoind and p2pool listen for connections to determine if they're ready.  The rest of it is just shell-script programming.
  • My script starts the X server with no window manager or anything else running underneath.  X needs to be up and running for GPU computing to be available; since this is a dedicated, headless mining rig, this is the minimal configuration.  If X is already started (as it probably is for a desktop machine), you'd want to omit that part of the script.
sr. member
Activity: 1077
Merit: 250
CryptoTalk.Org - Get Paid for every Post!
September 07, 2012, 06:27:37 AM
#4
Thank you all!

@crazyates

is this also true - not only for engine, memory, fan etc - but also for pool adress - username and password? (is it saved, too? so "./cgminer" is enough?)

@salfter

I don't know if I can understand how and where you edit this stuff... and I'm still guessing how I can autostart CGminer exactly with my account details etc... but I think I'll get it done)

hero member
Activity: 651
Merit: 501
My PGP Key: 92C7689C
September 06, 2012, 11:06:22 PM
#3
I knocked this script together today to autostart everything on my mining rig.  It starts the X server, bitcoind, p2pool, and cgminer in sequence, waiting for bitcoind to start before starting p2pool and for p2pool to start before starting cgminer.

Code:
#!/bin/bash
source /etc/profile
cd /home/salfter

# start X server
echo -n "Starting X server..."
screen -dmS X X
echo "done."

# start Bitcoin daemon
echo -n "Starting Bitcoin daemon..."
bitcoind -daemon 2>&1 >/dev/null

# wait for daemon to get up and running
echo -n "waiting..."
nc -z localhost 8332
until [ $? == 0 ]; do
  sleep 1
  nc -z localhost 8332
done
echo "done."

# start P2Pool
echo -n "Starting P2Pool..."
screen -dmS p2pool p2pool/run_p2pool.py -a 1N6UPydscNkUAL6ab1XaJ9i1hTV17EFr67 -f 1

# wait for P2Pool to get up and running
echo -n "waiting..."
nc -z localhost 9332
until [ $? == 0 ]; do
  sleep 1
  nc -z localhost 9332
done
echo "done."

# start miner
echo -n "Starting cgminer..."
screen -dmS miner cgminer
echo "done."

I call this from a script in /etc/local.d that runs it as a normal user, so the local runscript fires it up.  Most tasks get stuffed into screen sessions so you can check on them.  You'll probably want to change the address to which p2pool is to be paid...though if you leave mine in there, I won't complain. :-)
legendary
Activity: 952
Merit: 1000
September 06, 2012, 10:40:15 PM
#2
Hello,

I'm new to linux and have a Ubuntu 12.04. now + CGminer.

Everything fine, but I would like to automate the whole thing.

That means:

- autostart CGminer at system startup
- CGminer start with own preset , so I don't have to configure again

How can I do this? I use CGminer 2.7.5 - and I've seen the "example.conf" - but I don't find/know the place where the actual .conf file is located and I don't know how to autostart the whole thing.

Looking for help  Wink

Thank you

To get your config file, start CGMiner with all your settings, and press S and then W. This takes all your current settings and writes them to your config. Now when CGMiner starts up, it will use this config, no command line arguments needed!

To start up in Linux, I'm less sure about. I always used rc-update, but that was on Gentoo. There are a number of different ways, but I don't know which is best.
sr. member
Activity: 1077
Merit: 250
CryptoTalk.Org - Get Paid for every Post!
September 06, 2012, 06:32:59 PM
#1
Hello,

I'm new to linux and have a Ubuntu 12.04. now + CGminer.

Everything fine, but I would like to automate the whole thing.

That means:

- autostart CGminer at system startup
- CGminer start with own preset , so I don't have to configure again

How can I do this? I use CGminer 2.7.5 - and I've seen the "example.conf" - but I don't find/know the place where the actual .conf file is located and I don't know how to autostart the whole thing.

Looking for help  Wink

Thank you
Jump to: