Author

Topic: Simple shell script for starting my miners - linux? (Read 3074 times)

member
Activity: 84
Merit: 10
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.
full member
Activity: 238
Merit: 100
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
full member
Activity: 182
Merit: 100
Wow thanks buds!
hero member
Activity: 518
Merit: 500
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 )
member
Activity: 84
Merit: 10
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.
full member
Activity: 182
Merit: 100
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
Jump to: