Bitcoin Forum
November 13, 2024, 07:09:19 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Need CGMiner Help please (how to automate it)  (Read 3724 times)
biddicoin (OP)
Sr. Member
****
Offline Offline

Activity: 1077
Merit: 250

CryptoTalk.Org - Get Paid for every Post!


View Profile
September 06, 2012, 11: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

 
                                . ██████████.
                              .████████████████.
                           .██████████████████████.
                        -█████████████████████████████
                     .██████████████████████████████████.
                  -█████████████████████████████████████████
               -███████████████████████████████████████████████
           .-█████████████████████████████████████████████████████.
        .████████████████████████████████████████████████████████████
       .██████████████████████████████████████████████████████████████.
       .██████████████████████████████████████████████████████████████.
       ..████████████████████████████████████████████████████████████..
       .   .██████████████████████████████████████████████████████.
       .      .████████████████████████████████████████████████.

       .       .██████████████████████████████████████████████
       .    ██████████████████████████████████████████████████████
       .█████████████████████████████████████████████████████████████.
        .███████████████████████████████████████████████████████████
           .█████████████████████████████████████████████████████
              .████████████████████████████████████████████████
                   ████████████████████████████████████████
                      ██████████████████████████████████
                          ██████████████████████████
                             ████████████████████
                               ████████████████
                                   █████████
YoBit AirDrop $|
Get 700 YoDollars for Free!
🏆
crazyates
Legendary
*
Offline Offline

Activity: 952
Merit: 1000



View Profile
September 07, 2012, 03:40:15 AM
 #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.

Tips? 1crazy8pMqgwJ7tX7ZPZmyPwFbc6xZKM9
Previous Trade History - Sale Thread
salfter
Hero Member
*****
Offline Offline

Activity: 651
Merit: 501


My PGP Key: 92C7689C


View Profile WWW
September 07, 2012, 04:06:22 AM
 #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. :-)

Tipjars: BTC 1TipsGocnz2N5qgAm9f7JLrsMqkb3oXe2 LTC LTipsVC7XaFy9M6Zaf1aGGe8w8xVUeWFvR | My Bitcoin Note Generator | Pool Auto-Switchers: zpool MiningPoolHub NiceHash
Bitgem Resources: Pool Explorer Paper Wallet
biddicoin (OP)
Sr. Member
****
Offline Offline

Activity: 1077
Merit: 250

CryptoTalk.Org - Get Paid for every Post!


View Profile
September 07, 2012, 11: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)


 
                                . ██████████.
                              .████████████████.
                           .██████████████████████.
                        -█████████████████████████████
                     .██████████████████████████████████.
                  -█████████████████████████████████████████
               -███████████████████████████████████████████████
           .-█████████████████████████████████████████████████████.
        .████████████████████████████████████████████████████████████
       .██████████████████████████████████████████████████████████████.
       .██████████████████████████████████████████████████████████████.
       ..████████████████████████████████████████████████████████████..
       .   .██████████████████████████████████████████████████████.
       .      .████████████████████████████████████████████████.

       .       .██████████████████████████████████████████████
       .    ██████████████████████████████████████████████████████
       .█████████████████████████████████████████████████████████████.
        .███████████████████████████████████████████████████████████
           .█████████████████████████████████████████████████████
              .████████████████████████████████████████████████
                   ████████████████████████████████████████
                      ██████████████████████████████████
                          ██████████████████████████
                             ████████████████████
                               ████████████████
                                   █████████
YoBit AirDrop $|
Get 700 YoDollars for Free!
🏆
salfter
Hero Member
*****
Offline Offline

Activity: 651
Merit: 501


My PGP Key: 92C7689C


View Profile WWW
September 07, 2012, 02:29:50 PM
 #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.

Tipjars: BTC 1TipsGocnz2N5qgAm9f7JLrsMqkb3oXe2 LTC LTipsVC7XaFy9M6Zaf1aGGe8w8xVUeWFvR | My Bitcoin Note Generator | Pool Auto-Switchers: zpool MiningPoolHub NiceHash
Bitgem Resources: Pool Explorer Paper Wallet
crazyates
Legendary
*
Offline Offline

Activity: 952
Merit: 1000



View Profile
September 07, 2012, 02:42:47 PM
 #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.

Tips? 1crazy8pMqgwJ7tX7ZPZmyPwFbc6xZKM9
Previous Trade History - Sale Thread
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!