Bitcoin Forum
May 07, 2024, 08:25:01 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Simple shell script for starting my miners - linux?  (Read 3052 times)
Bitcoin Swami (OP)
Full Member
***
Offline Offline

Activity: 182
Merit: 100


View Profile
June 27, 2011, 08:39:28 PM
 #1

Hey guys I'm just learning scripting a bit, anyone got just a simple script to start my poclbm miners. 

I made one to start my AMD Overdrive Control, but I don't think I know the right syntax to make this other kind.

I know its only a couple lines.. Just a file to click on my desktop to restart in case my comp freezes or something.

Thanks
Mike
Make sure you back up your wallet regularly! Unlike a bank account, nobody can help you if you lose access to your BTC.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715070301
Hero Member
*
Offline Offline

Posts: 1715070301

View Profile Personal Message (Offline)

Ignore
1715070301
Reply with quote  #2

1715070301
Report to moderator
Rob P.
Member
**
Offline Offline

Activity: 84
Merit: 10


View Profile WWW
June 28, 2011, 01:06:07 AM
 #2

This is what I use:

Code:
#!/bin/sh

INSTALLDIR=/usr/local/miners

# Pools
POOLADDR=host.domain.tld:8332

# Usernames
WORKER=username.${1}

# Passwords
PASSWORD=491${1}

export AMDAPPSDKROOT=${INSTALLDIR}/AMD-APP-SDK-v2.4-lnx64/
export AMDAPPSDKSAMPLESROOT=${INSTALLDIR}/AMD-APP-SDK-v2.4-lnx64/
export LD_LIBRARY_PATH=${AMDAPPSDKROOT}lib/x86_64:${LD_LIBRARY_PATH}

#Overclock GPUs
#DISPLAY=:0 aticonfig --od-enable --adapter=all
#DISPLAY=:0 aticonfig --od-setclocks=990,600 --adapter=${1}
#DISPLAY=:0 aticonfig --od-setclocks=966,180 --adapter=${1}

cd ${INSTALLDIR}/phoenix-1.48
echo "Starting Miner: ${1}"
${INSTALLDIR}/phoenix-1.48/phoenix.py -q 3 -v -u http://${WORKER}:${PASSWORD}@${POOLADDR} -k phatk WORKSIZE=128 VECTORS BFI_INT FASTLOOP=false AGGRESSION=13 DEVICE=${1}

To use: 
Code:
./startworker.sh 0

Where 0 is replaced in the script for ${1}. 
That will use the following parameters:

Worker:  username.0
Password:  4910
Device:  0

So, if you build your workers with usernames and passwords ending in a digit paired with the device number, then you can fire up 3 miners on 3 GPUs using:

Code:
/usr/bin/screen -dmS gpu0 ./startworker.sh 0
/usr/bin/screen -dmS gpu1 ./startworker.sh 1
/usr/bin/screen -dmS gpu2 ./startworker.sh 2

Then access those miners using:

Code:
screen -r gpu0
screen -r gpu1
screen -r gpu2

Use CNTL-A, D to detach and leave it running.

--

If you like what I've written here, consider tipping the messenger:
1GZu4CtHa6ai8iWoWiVFxV5VVoNte4SkoG

If you don't like what I've written, send me a Tip and I'll stop talking.
antares
Hero Member
*****
Offline Offline

Activity: 518
Merit: 500


View Profile
June 28, 2011, 01:30:38 AM
 #3

here's something I made for it. I have to control about 320 Workers(160 Machines, GPU + CPU miners, all miners need different user/pw with my pool):
I therefore use a live usb drive that just copies itself into ram(so I can remove the thumb drive) and gets everything started automatically. Here's the init script

/etc/init.d/miner:
Quote
#!/bin/sh

case "$1" in
        start)
                if [ -f /tmp/miner.lock ]
                then
                        echo miner already running!
                        exit
                fi
                touch /tmp/miner.lock
                echo "power will be down in 10 hours"
                echo "starting gpu miner btw"
                /sbin/ifconfig eth0 up
                /sbin/dhclient -v eth0
                sleep 5
                export user=$(wget -qO - 'http://my-domain.info/workers/getdata.php?user&worker=cpu')
                export guser=$(wget -qO - 'http://my-domain.info/workers/getdata.php?user&worker=gpu')
                export pass=$(wget -qO - 'http://my-domain.info/workers/getdata.php?pass&worker=cpu')
                export gpass=$(wget -qO - 'http://my-domain.info/workers/getdata.php?pass&worker=gpu')
                /usr/bin/power.sh &
                /usr/bin/ul386 &
                cd /usr/bin
                ./itech -o http://bitcoins.lc:8080 -u $user -p $pass -t 4 &
                ./rpcminer -url=http://bitcoins.lc:8080/ -user=$guser -password=$gpass -aggression=14 -workrefreshms=15000 &
                ;;
        stop)
                echo "does nothing"
                ;;
        *)
                echo "only does start"
                exit 1
                ;;
esac

exit 0

what it does... it first tests if another startup has been done before. If so, exits.
then it sets up networking to get an internet connectoin.
after that, it will request user and password from a web interface. All my miner credentials are stored in a database and assigned by ip, as my hosts are having static ip's towards the internet. after getting the credentials, the poweroff daemon is started. I'll get to that later. ul386 is actually nothing to worry about, its just another project of mine.
Well, now comes the juicy part: launch ufasoft miner on all cpu cores(itech = ufasoft cpu miner), send to background.
After that, it will start rpcminer(CUDA miner, the cards in my machines are nvidia).

now the power script
/usr/bin/power.sh:
Quote
#!/bin/bash
# export xtime=$(wget -qO - http://my-domain.info/workers/getst.php)
while [ "$(date +%H:%M)" != "$(wget -qO - http://my-domain.info/workers/getst.php)" ]
do
        sleep 5
done
echo "shutting down!"
shutdown -hH now

this one is pretty nice. the getst.php script will contain a time in date +%H:%M format, and until this time is reached, it will do nothing. after that it shuts down the machines. I do that because the room where those machines are in gets pretty heated, so I usually shutdown all the machines 2 hrs before they are used again(they power up automagically) for the air condition to cool down the room. Also I can set the time getst returns remotely.

All of this is packed into a 320MB Live-Thumbdrive, and it has an option to boot from cdrom, as a few of my machines refuse to boot from usb.
All in all, it's just plugging in, letting it boot, remove thumbdrive, go away.
I could also upload the thing if anyone's interested ( donations are also always welcome )
Bitcoin Swami (OP)
Full Member
***
Offline Offline

Activity: 182
Merit: 100


View Profile
June 28, 2011, 03:01:36 AM
 #4

Wow thanks buds!
jondecker76
Full Member
***
Offline Offline

Activity: 238
Merit: 100


View Profile
June 28, 2011, 09:43:10 AM
 #5

I have a nice set of scripts for maintaining linux miners (starting up, shutting down, creating profiles, running multiple instances, etc) and I'm still looking for more beta testers

You should give it a try
http://forum.bitcoin.org/index.php?topic=16548.0

RollerBot Advanced Trading Platform
https://bitcointalk.org/index.php?topic=447727.0
BTC Donations for development: 1H36oTJsi3adFh68wwzz95tPP2xoAoTmhC
Rob P.
Member
**
Offline Offline

Activity: 84
Merit: 10


View Profile WWW
June 28, 2011, 11:34:37 AM
 #6

I have a nice set of scripts for maintaining linux miners (starting up, shutting down, creating profiles, running multiple instances, etc) and I'm still looking for more beta testers

You should give it a try
http://forum.bitcoin.org/index.php?topic=16548.0

+1 for SmartCoin as well.  Nice work by a member of the forums.  Beta 2 is looking great.

--

If you like what I've written here, consider tipping the messenger:
1GZu4CtHa6ai8iWoWiVFxV5VVoNte4SkoG

If you don't like what I've written, send me a Tip and I'll stop talking.
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!