Bitcoin Forum

Bitcoin => Mining => Topic started by: Yanz on July 15, 2011, 08:00:42 AM



Title: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 15, 2011, 08:00:42 AM
All my mining rigs were running Windows 7 but they kept BSODing and crashing and I got tired of reseting them so I tried Linux. It kicked my butt the first day or so but in the end I got it to do my bidding :)

So in this guide I'll show you how to setup LinuxCoin to
  • run off a USB thumb drive
  • automatically boot and start mining unattended
  • automatically set overclocks and load fan speed profiles
  • setup a software watchdog to automatically kill and restart crashed miners
  • ???
  • Profit


Credit: Most of this is based off a post by kjj http://forum.bitcoin.org/index.php?topic=7374.msg248025#msg248025 (http://forum.bitcoin.org/index.php?topic=7374.msg248025#msg248025)
I couldn't get it to work for me so it's heavily modified by me to run on a stock LinuxCoin 0.2.1b install.

I'm using a 4GB flash drive I had laying around. I recommend good quality high speed flash drive. I'm using one of these http://www.newegg.com/Product/Product.aspx?Item=N82E16820220251 (http://www.newegg.com/Product/Product.aspx?Item=N82E16820220251)

Rest of my Hardware
Two Sapphire 5850 Xtremes, Asus M4A79XTD EVO, 2GB RAM, Sempron 140 processor, 550W CoolerMaster PSU

OK let's get started.

1. Grab a copy of LinuxCoin 0.2.1b http://www.linuxcoin.co.uk/ (http://www.linuxcoin.co.uk/)
2. Download Unetbootin http://unetbootin.sourceforge.net/ (http://unetbootin.sourceforge.net/)
3. Download the persistence file. I got the 2GB (2048.zip) but I think the others would work too http://linuxcoin.co.uk/downloads/persistence/ (http://linuxcoin.co.uk/downloads/persistence/)
4. Run unetbootin and select the LinuxCoin iso you just downloaded. Let it do it's thing. When it's done click exit but don't remove your flash drive yet.
5. Extract the persistence file to the root of your flash drive.
6. Open syslinux.cfg and replace it with this:
Code:
default menu.c32
prompt 0
menu title LinuxCoin
timeout 2

label linuxcoin
menu label LinuxCoin Persistent (flash only)
kernel /live/vmlinuz
append initrd=/live/initrd.img boot=live config quiet splash persistent rw vga=791 noprompt
This let will make it autoboot into persistence mode. The noprompt disables the press ENTER to reboot/shutdown message at the end.

7. Plug the flash drive into your mining rig and boot it off the USB. Setup networking/wallpaper/whatever else you want to do. You might want to test out mining/connecting to the net/etc. Assuming you have no problems booting and running LinuxCoin...proceed.

8. Make the file and/or folders /home/user/.config/autostart/auto.desktop and add the following contents:
Code:
[Desktop Entry]
Encoding=UTF-8
Name=coin
Exec=lxterminal --command "sh /home/user/start.sh"
Terminal=true

9. Open up terminal run AMDOverdriveCtrl -h | grep active. (Hint type AMD and press tab to autocomplete) Note the index number of your active adapters. If you only have one then it is 0. Mine are 0 and 3.

10. Now run AMDOverdriveCtrl -i 0. This opens up AMDOverdriveCtrl GUI for card 0. Overclock your card and setup your fan profiles. Export it as a file called gpu0.ovdr. Repeat for each card you have and change index numbers accordingly (ie AMDOverdriveCtrl -i 3)

11. Make the file /home/user/start.sh and put paste in the following:
Code:
#!/bin/bash
sleep 20
xhost +
echo $DISPLAY > /home/user/.display
AMDOverdriveCtrl -i 0 -b gpu0.ovdr
AMDOverdriveCtrl -i 3 -b gpu3.ovdr
lxterminal --title miner1 --command "sh /home/user/miner1.sh"
lxterminal --title miner2 --command "sh /home/user/miner2.sh"
This will make the computer wait 20 seconds to loadup/connect to the network/etc. Then it will load the overclock and fan profiles for each GPU and then start your miners.

12. Make the files /home/user/miner1.sh and /home/user/miner2.sh and fill in:
Code:
#!/bin/bash
cd /opt/miners/phoenix
./phoenix.py -u http://yanz_1:pass@uswest.btcguild.com:8332/ -q 7 -k phatk BFI_INT VECTORS FASTLOOP=false AGGRESSION=11 DEVICE=0
Modify accordingly to mine for yourself.

13. Make the file /home/user/restart.sh and fill it with these magical lines:
Code:
#!/bin/bash
export DISPLAY=`cat /home/user/.display`
pc=`ps waxuf | grep miner1.sh -c`
ld=`aticonfig --odgc --adapter=0 | grep "GPU load" | cut -c 30-35 | cut -d % -f 1`
if [ $pc -lt "2" ] || [ $ld -lt "50" ] ; then
 kill `ps -ef | grep miner1 | grep -v grep | awk '{print $2}'`
 lxterminal --title miner1 --command sh /home/user/miner1.sh &
 date +"%D %r miner1 restarted" >> /home/user/cron_job.log
fi
pc=`ps waxuf | grep miner2.sh -c`
ld=`aticonfig --odgc --adapter=1 | grep "GPU load" | cut -c 30-35 | cut -d % -f 1`
if [ $pc -lt "2" ] || [ $ld -lt "50" ] ; then
 kill `ps -ef | grep miner2 | grep -v grep | awk '{print $2}'`
 lxterminal --title miner2 --command sh /home/user/miner2.sh &
 date +"%D %r miner2 restarted" >> /home/user/cron_job.log
fi
This will check the each GPU to make sure the load is greater than 50% and check to see that the process miner1 and miner2 exist. If not it will kill and restart the appropriate miner. It also logs it to /home/user/cron_job.log

14. Run sudo crontab -e -u user and add this line after the last line:
Code:
0-59 * * * * sh /home/user/restart.sh
This runs the restart miner script every minute.

15. Reboot

16.  ???

17. Profit

18. Donate to 1LeLE4PP72CNfHDmT3JyFUQehZ4i41LxPz if this helped you.  :P

Comments and improvements welcome.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: tysat on July 15, 2011, 08:08:19 AM
Sexy guide!

I assume for more than 2 cards all you would do is add to the end of restart.sh?

Code:
pc=`ps waxuf | grep miner3.sh -c`
ld=`aticonfig --odgc --adapter=1 | grep "GPU load" | cut -c 30-35 | cut -d % -f 1`
if [ $pc -lt "2" ] || [ $ld -lt "50" ] ; then
 kill `ps -ef | grep miner3 | grep -v grep | awk '{print $2}'`
 lxterminal --title miner3 --command sh /home/user/miner3.sh &
 date +"%D %r miner3 restarted" >> /home/user/cron_job.log
fi

Just want to make sure I'm not being dumb as I'm tired...


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 15, 2011, 08:17:53 AM
Close... ;)
You forgot to change the adapter number.
change line 2 to:
Code:
ld=`aticonfig --odgc --adapter=2 | grep "GPU load" | cut -c 30-35 | cut -d % -f 1`
Other than that looks like your all set.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: evlew on July 15, 2011, 04:27:39 PM
DrGr33n really came through with linux coin
KJJ really came through with those scripts.
You came through with this guide for those who have a hard time with this sort of stuff.
I can confirm this setup works great.  Although I am still on old version of linuxcoin I have been running stable and overclocked for a couple weeks now since implementing.

Maybe you should add a section for SmartCoin for the benefit of redundancy of pools.  That's something I haven't gotten around to yet, and would love a cut and dry guide for it.  I'm sure it's not hard, but I'm sure it can be cleaned up a bit.


Thanks to DrGr33n, KJJ, and Yanz


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 16, 2011, 01:27:15 AM
I actually haven't tried SmartCoin yet but if I do I'll make another guide too.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: tysat on July 16, 2011, 03:20:39 AM
Quote
user@linuxcoin:/opt/miners/phoenix$ ./phoenix.py -u http://my_user:my_pass@pit.deepbit.net:8332 -k phatk BFI_INT VECTORS FASTLOOP=false AGGRESSION=11 DEVICE=0 WORKSIZE=256
Traceback (most recent call last):
  File "./phoenix.py", line 123, in <module>
    miner.start(options)
  File "/opt/miners/phoenix/Miner.py", line 75, in start
    self.kernel = self.options.makeKernel(KernelInterface(self))
  File "./phoenix.py", line 112, in makeKernel
    self.kernel = kernelModule.MiningKernel(requester)
  File "kernels/phatk/__init__.py", line 132, in __init__
    platforms = cl.get_platforms()
pyopencl.LogicError: clGetPlatformIDs failed: platform not found khr

So when I try to start my miners I get the above error.  Any ideas?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: triforcelink on July 16, 2011, 03:52:30 AM
Oh wow, just in time! I'm moving all my mining gear to another room and in the process i wanted to make it all headless. thanks for this!


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: max in montreal on July 16, 2011, 07:04:58 AM
Quote
8. Make the file and/or folders /home/user/.config/autostart/auto.desktop and add the following contents:


Code:
[Desktop Entry]
Encoding=UTF-8
Name=coin
Exec=lxterminal --command "sh /home/user/start.sh"
Terminal=true
when doing this step and saving the file as auto.desktop and closing leafpad, the file is now called coin. Is this how it is supposed to be?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: checkmate on July 16, 2011, 09:06:51 AM
I have a question, since you seem to have some knowledge about Linux:

Are there noticeable differences in speed to Win7?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 16, 2011, 09:31:52 AM
Quote
user@linuxcoin:/opt/miners/phoenix$ ./phoenix.py -u http://my_user:my_pass@pit.deepbit.net:8332 -k phatk BFI_INT VECTORS FASTLOOP=false AGGRESSION=11 DEVICE=0 WORKSIZE=256
Traceback (most recent call last):
  File "./phoenix.py", line 123, in <module>
    miner.start(options)
  File "/opt/miners/phoenix/Miner.py", line 75, in start
    self.kernel = self.options.makeKernel(KernelInterface(self))
  File "./phoenix.py", line 112, in makeKernel
    self.kernel = kernelModule.MiningKernel(requester)
  File "kernels/phatk/__init__.py", line 132, in __init__
    platforms = cl.get_platforms()
pyopencl.LogicError: clGetPlatformIDs failed: platform not found khr

So when I try to start my miners I get the above error.  Any ideas?
Hmm... Seems like something isn't installed right. Is this a stock LinuxCoin install? Mine worked right away


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 16, 2011, 09:33:25 AM
Quote
8. Make the file and/or folders /home/user/.config/autostart/auto.desktop and add the following contents:


Code:
[Desktop Entry]
Encoding=UTF-8
Name=coin
Exec=lxterminal --command "sh /home/user/start.sh"
Terminal=true
when doing this step and saving the file as auto.desktop and closing leafpad, the file is now called coin. Is this how it is supposed to be?

I made mine using nano and I didn't notice. Now that I check apparently that's how it's supposed to be.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 16, 2011, 09:35:12 AM
I have a question, since you seem to have some knowledge about Linux:

Are there noticeable differences in speed to Win7?
I'm not sure, I moved to Linux because it's so much more reliable. My windows machines kept crashing/BSODing. Like twice a day. It got really annoying. Ask around on the forum I guess.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: jondecker76 on July 16, 2011, 03:11:39 PM
I think the watchdog may need a little work.

The most common lockup that you will find is when a card locks up due to instability from too aggressive of an overclock.  When this happens, aticonfig will return 99% load, even though the card is essentially dead and not doing anything

(in fact, I don't think I've ever seen a GPU go below 50% in any case other than A) purposefully  throttling the card or B) when the card hits high temperature limit and throttles its self down for protection. - in either case, a restart of the miner wouldn't really be doing much)


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: evlew on July 16, 2011, 09:05:36 PM
I think the watchdog may need a little work.

The most common lockup that you will find is when a card locks up due to instability from too aggressive of an overclock.  When this happens, aticonfig will return 99% load, even though the card is essentially dead and not doing anything

(in fact, I don't think I've ever seen a GPU go below 50% in any case other than A) purposefully  throttling the card or B) when the card hits high temperature limit and throttles its self down for protection. - in either case, a restart of the miner wouldn't really be doing much)

simple solution.  Back your overclocks to a stable speed and reap the reward and not worrying about your rigs.  the benefit of rigs not locking up is well worth the 2-5% performance hit from an extreme overclock.

I run a pretty decent overclock (past bios limit) and this config works great for me.  results may vary for others, but i suggest trying it before presenting hypothetical situations.

besides when one of my cards locks up it freezes the whole machine, in which case i doubt the script is of any use.  point being... find a stable overclock.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: checkmate on July 17, 2011, 11:02:03 AM
I have a question, since you seem to have some knowledge about Linux:

Are there noticeable differences in speed to Win7?
I'm not sure, I moved to Linux because it's so much more reliable. My windows machines kept crashing/BSODing. Like twice a day. It got really annoying. Ask around on the forum I guess.

Well, then there's no need for me to switch, since my Win7 rig is working for five days already and never crashed so far...


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 17, 2011, 01:10:38 PM
I have a question, since you seem to have some knowledge about Linux:

Are there noticeable differences in speed to Win7?
I'm not sure, I moved to Linux because it's so much more reliable. My windows machines kept crashing/BSODing. Like twice a day. It got really annoying. Ask around on the forum I guess.

Well, then there's no need for me to switch, since my Win7 rig is working for five days already and never crashed so far...
Lucky you.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 17, 2011, 01:14:42 PM
I think the watchdog may need a little work.

The most common lockup that you will find is when a card locks up due to instability from too aggressive of an overclock.  When this happens, aticonfig will return 99% load, even though the card is essentially dead and not doing anything

(in fact, I don't think I've ever seen a GPU go below 50% in any case other than A) purposefully  throttling the card or B) when the card hits high temperature limit and throttles its self down for protection. - in either case, a restart of the miner wouldn't really be doing much)
yeah, pretty much what evlew said: unstable is...well not stable. I think you get better returns from a stable overclock.
Though I am working on a hardware watch dog to monitor my machines. I'll post a guide once I get it working..


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: jondecker76 on July 17, 2011, 02:36:02 PM
Oh, don't worry about me -  I personally don't overclock to the point of instability. But, as a software author, a majority of my support questions and problems revolve around users that overclock too aggressively, which is why I know quite a bit about the problem.
My only point was, that the software watchdog really doesn't do much, as it A) doesn't help a system made unstable from aggressive overclocking, and B) I know of no reasons other than what I posted that would cause a GPU to go below 50% load. (I.e. restarting a miner that is purposely throttled will have no positive outcome, restarting a miner that went low load because of overtemp will have no positive outcome, and restarting a miner pointed to a ddos'd pool will have no positive outcome)
Perhaps there is more reasons to have a software watchdog than I'm thinking of?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 18, 2011, 07:27:12 AM
Oh, don't worry about me -  I personally don't overclock to the point of instability. But, as a software author, a majority of my support questions and problems revolve around users that overclock too aggressively, which is why I know quite a bit about the problem.
My only point was, that the software watchdog really doesn't do much, as it A) doesn't help a system made unstable from aggressive overclocking, and B) I know of no reasons other than what I posted that would cause a GPU to go below 50% load. (I.e. restarting a miner that is purposely throttled will have no positive outcome, restarting a miner that went low load because of overtemp will have no positive outcome, and restarting a miner pointed to a ddos'd pool will have no positive outcome)
Perhaps there is more reasons to have a software watchdog than I'm thinking of?
Well it's not designed to solve problem A so its moot. Problem B: Solves "Miner is idle" messages, and miner crashing (ie command window disappears, process dies)


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: digger on July 18, 2011, 10:59:12 PM
can the cron job work?


when I setup the cronjob  and added a debug info

echo "miner1->$pc $ld" >>  /home/user/cron_job.log

the $ld always be blank,  it seems "aticonfig --odgc --adapter=1" can;t been run at cronjob?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: max in montreal on July 19, 2011, 01:36:46 PM
Quote
10. Now run AMDOverdriveCtrl -i 0. This opens up AMDOverdriveCtrl GUI for card 0. Overclock your card and setup your fan profiles. Export it as a file called gpu0.ovdr. Repeat for each card you have and change index numbers accordingly (ie AMDOverdriveCtrl -i 3)

11. Make the file /home/user/start.sh and put paste in the following:

Code:
#!/bin/bash
sleep 20
AMDOverdriveCtrl -i 0 -b gpui0.ovdr
AMDOverdriveCtrl -i 3 -b gpui3.ovdr
lxterminal --title miner1 --command "sh /home/user/miner1.sh"
lxterminal --title miner2 --command "sh /home/user/miner2.sh"This will make the computer wait 20 seconds to loadup/connect to the network/etc. Then it will load the overclock and fan profiles for each GPU and then start your miners.

Is the above correct?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Reckman on July 19, 2011, 05:02:59 PM
Quote
10. Now run AMDOverdriveCtrl -i 0. This opens up AMDOverdriveCtrl GUI for card 0. Overclock your card and setup your fan profiles. Export it as a file called gpu0.ovdr. Repeat for each card you have and change index numbers accordingly (ie AMDOverdriveCtrl -i 3)

11. Make the file /home/user/start.sh and put paste in the following:

Code:
#!/bin/bash
sleep 20
AMDOverdriveCtrl -i 0 -b gpui0.ovdr
AMDOverdriveCtrl -i 3 -b gpui3.ovdr
lxterminal --title miner1 --command "sh /home/user/miner1.sh"
lxterminal --title miner2 --command "sh /home/user/miner2.sh"This will make the computer wait 20 seconds to loadup/connect to the network/etc. Then it will load the overclock and fan profiles for each GPU and then start your miners.

Is the above correct?

No they need to match


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: shotgun on July 19, 2011, 06:24:46 PM
Headless automation is great. Thanks for the write up.

From personal experience, it's way easier to manage pool H/A with Bitcoin Mining Proxy than with Smartcoin or some homegrown scripts that watch load. I have 4 boxes with 3 cards each and I'm using MiningMonitor to notify me of down'd workers -  having to ssh into a box to see Smartcoin information is a waste of my time. I have a separate web/db server running the proxy app so it doesn't get affected by rigs that need to reboot or have work done to them. YMMV.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Reckman on July 20, 2011, 12:23:32 AM
the restart script doesnt seem to be working for me....followed this exactly

is it working for others?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 20, 2011, 02:15:39 AM
Quote
10. Now run AMDOverdriveCtrl -i 0. This opens up AMDOverdriveCtrl GUI for card 0. Overclock your card and setup your fan profiles. Export it as a file called gpu0.ovdr. Repeat for each card you have and change index numbers accordingly (ie AMDOverdriveCtrl -i 3)

11. Make the file /home/user/start.sh and put paste in the following:

Code:
#!/bin/bash
sleep 20
AMDOverdriveCtrl -i 0 -b gpui0.ovdr
AMDOverdriveCtrl -i 3 -b gpui3.ovdr
lxterminal --title miner1 --command "sh /home/user/miner1.sh"
lxterminal --title miner2 --command "sh /home/user/miner2.sh"This will make the computer wait 20 seconds to loadup/connect to the network/etc. Then it will load the overclock and fan profiles for each GPU and then start your miners.

Is the above correct?

No they need to match
Yeah, they need to match. I was copying/pasting my own script and for some reason I put an extra i in there. Fixed in the post. Thanks for pointing that out.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 20, 2011, 02:17:51 AM
can the cron job work?


when I setup the cronjob  and added a debug info

echo "miner1->$pc $ld" >>  /home/user/cron_job.log

the $ld always be blank,  it seems "aticonfig --odgc --adapter=1" can;t been run at cronjob?

Hmm, I have no idea, I haven't tried. Maybe you should fix the $Id problem first?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 20, 2011, 02:19:07 AM
the restart script doesnt seem to be working for me....followed this exactly

is it working for others?
Try this:
Exit out one of the miners.
Then run sh restart.sh
See what happens.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 20, 2011, 02:24:10 AM
Headless automation is great. Thanks for the write up.

From personal experience, it's way easier to manage pool H/A with Bitcoin Mining Proxy than with Smartcoin or some homegrown scripts that watch load. I have 4 boxes with 3 cards each and I'm using MiningMonitor to notify me of down'd workers -  having to ssh into a box to see Smartcoin information is a waste of my time. I have a separate web/db server running the proxy app so it doesn't get affected by rigs that need to reboot or have work done to them. YMMV.
You have your point but this is designed to keep the GPU's online, not the connection to the pool alive. If the pool goes down then no matter how many restarts, the pool isn't going to come back up. And MiningMonitor is kinda expensive. Ins't it for profitable to let the worker stay down until you get home then to pay MiningMonitor's fees?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: shotgun on July 20, 2011, 04:28:35 AM
Headless automation is great. Thanks for the write up.

From personal experience, it's way easier to manage pool H/A with Bitcoin Mining Proxy than with Smartcoin or some homegrown scripts that watch load. I have 4 boxes with 3 cards each and I'm using MiningMonitor to notify me of down'd workers -  having to ssh into a box to see Smartcoin information is a waste of my time. I have a separate web/db server running the proxy app so it doesn't get affected by rigs that need to reboot or have work done to them. YMMV.
You have your point but this is designed to keep the GPU's online, not the connection to the pool alive. If the pool goes down then no matter how many restarts, the pool isn't going to come back up. And MiningMonitor is kinda expensive. Ins't it for profitable to let the worker stay down until you get home then to pay MiningMonitor's fees?

MiningMonitor is only 1BTC/month. Pete has added so many new features in the last two weeks that it is fully worth the cost. The proxy + miningmonitor has solved all of my uptime and notification issues. For example, if one of my 12 GPUs goes down (or all b/c a pool is offline) at 10am and I'm at the office and don't get home until 6pm - then it definitely makes sense to pay 1BTC/month to know about it prior to losing 8 hours of mining time. Even if I were to ssh into my home LAN (which I do anyway) to fix things, that's a whole bunch of micromanagement during the work day when I'm supposed to be doing things at work. Handling the miners should almost never happen - they should be online 24x7 and if the primary pool is down then the secondary and tertiary pool should be available. If my outgoing internet connection on the LAN goes down then that's another story - and, once I get my secondary cisco router online - the internet will automagically connect to my secondary provider.

Miners must be active 24x7! :D


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: jondecker76 on July 20, 2011, 07:24:20 AM
Headless automation is great. Thanks for the write up.

From personal experience, it's way easier to manage pool H/A with Bitcoin Mining Proxy than with Smartcoin or some homegrown scripts that watch load. I have 4 boxes with 3 cards each and I'm using MiningMonitor to notify me of down'd workers -  having to ssh into a box to see Smartcoin information is a waste of my time. I have a separate web/db server running the proxy app so it doesn't get affected by rigs that need to reboot or have work done to them. YMMV.
Not to try to take focus away from the main topic of the thread here - but..
I think you have mistaken the purpose of smartcoin - its not meant to be a monitor at all. Its meant to automatically control your mining operation so that you don't have to check on it all the time (failovers, lockup detection, automatic restarting of miners, etc) - as well as give you features like profiles (I can change where I am mining to in less than 5 seconds just by changing to another profile that I have defined), easy multi-instance setups etc. Coming versions will have multi-machine support, munin plugin support (trending graphs viewable over the internet), email/SMS notifications, etc.  Sure, it has an overview "status" screen where you can look at a quick overview of the operation, but thats not the purpose of smartcoin.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Reckman on July 20, 2011, 07:50:34 AM
the restart script doesnt seem to be working for me....followed this exactly

is it working for others?
Try this:
Exit out one of the miners.
Then run sh restart.sh
See what happens.

It doesn't restart them, It logs it, but doesnt start the miners back for some reason.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 20, 2011, 08:59:56 AM
the restart script doesnt seem to be working for me....followed this exactly

is it working for others?
Try this:
Exit out one of the miners.
Then run sh restart.sh
See what happens.

It doesn't restart them, It logs it, but doesnt start the miners back for some reason.
Any errors when you manually run it?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 20, 2011, 09:05:50 AM
MiningMonitor is only 1BTC/month. Pete has added so many new features in the last two weeks that it is fully worth the cost. The proxy + miningmonitor has solved all of my uptime and notification issues. For example, if one of my 12 GPUs goes down (or all b/c a pool is offline) at 10am and I'm at the office and don't get home until 6pm - then it definitely makes sense to pay 1BTC/month to know about it prior to losing 8 hours of mining time. Even if I were to ssh into my home LAN (which I do anyway) to fix things, that's a whole bunch of micromanagement during the work day when I'm supposed to be doing things at work. Handling the miners should almost never happen - they should be online 24x7 and if the primary pool is down then the secondary and tertiary pool should be available. If my outgoing internet connection on the LAN goes down then that's another story - and, once I get my secondary cisco router online - the internet will automagically connect to my secondary provider.

Miners must be active 24x7! :D
I think you missed the point. When miningmonitor notifies you of a downed miner you still have to manually reset it. What the script does is detect the downed miner and restart it without telling out.

MiningMonitor
Miner down -> MiningMonitor notification -> You reset -> miner

Scripts
miner down -> script detects -> script resets ->miner

No middle man -> No money spent  :)

Anyways, that's how I view it. If MiningMonitor works for your setup then by all means use it. I'm not here to make you change your setup, I'm just stating the way I see it.

Yes indeed 24x7 mining ftw! :)


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: shotgun on July 20, 2011, 05:18:52 PM
MiningMonitor is only 1BTC/month. Pete has added so many new features in the last two weeks that it is fully worth the cost. The proxy + miningmonitor has solved all of my uptime and notification issues. For example, if one of my 12 GPUs goes down (or all b/c a pool is offline) at 10am and I'm at the office and don't get home until 6pm - then it definitely makes sense to pay 1BTC/month to know about it prior to losing 8 hours of mining time. Even if I were to ssh into my home LAN (which I do anyway) to fix things, that's a whole bunch of micromanagement during the work day when I'm supposed to be doing things at work. Handling the miners should almost never happen - they should be online 24x7 and if the primary pool is down then the secondary and tertiary pool should be available. If my outgoing internet connection on the LAN goes down then that's another story - and, once I get my secondary cisco router online - the internet will automagically connect to my secondary provider.

Miners must be active 24x7! :D
I think you missed the point. When miningmonitor notifies you of a downed miner you still have to manually reset it. What the script does is detect the downed miner and restart it without telling out.

MiningMonitor
Miner down -> MiningMonitor notification -> You reset -> miner

Scripts
miner down -> script detects -> script resets ->miner

No middle man -> No money spent  :)

Anyways, that's how I view it. If MiningMonitor works for your setup then by all means use it. I'm not here to make you change your setup, I'm just stating the way I see it.

Yes indeed 24x7 mining ftw! :)

I understand what SmartCoin does - but since I have actually spend time with both SmartCoin and BTC-mining-proxy I can say from *my* experience that the proxy accomplishes the purpose much easier and cleaner than SmartCoin. I can switch pools for all 12 GPUs in one click of a web interface with BTC Mining Proxy, where as SmartCoin I have to go and SSH into my bastion host, then ssh into the rigs, then get into the smartcoin interface, then issue a couple of commands. The proxy has a protected web interface that I can access much easier.

I'm not trying to bad mouth smartcoin - it's a valid project and I'm glad its being developed. I just don't think it works as well as the combination of miningmonitor (trending and graphs and email/sms notification) and the proxy (pool management, worker management web interface, dashboard to see all 12GPUs state in one screen).

If smartcoin works for you then that's great. It frustrated me and I didn't like the way it manages workers/pools/profiles/etc.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Reckman on July 21, 2011, 02:08:36 AM
the restart script doesnt seem to be working for me....followed this exactly

is it working for others?
Try this:
Exit out one of the miners.
Then run sh restart.sh
See what happens.

It doesn't restart them, It logs it, but doesnt start the miners back for some reason.
Any errors when you manually run it?


Code:
user@linuxcoin:~$ export DISPLAY=`cat /home/user/.display`
user@linuxcoin:~$ pc=`ps waxuf | grep miner1.sh -c`
user@linuxcoin:~$ ld=`aticonfig --odgc --adapter=0 | grep "GPU load" | cut -c 30-35 | cut -d % -f 1`
aticonfig: This program must be run as root when no X server is active
user@linuxcoin:~$ if [ $pc -lt "2" ] || [ $ld -lt "50" ] ; then
>  kill `ps -ef | grep miner1 | grep -v grep | awk '{print $2}'`
>  lxterminal --title miner1 --command "sh /home/user/miner1.sh" &
>  date +"%D %r miner1 restarted" >> /home/user/cron_job.log
> fi
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
[1] 3583
user@linuxcoin:~$ pc=`
(lxterminal:3583): Gtk-WARNING **: cannot open display:

[1]+  Exit 1                  lxterminal --title miner1 --command "sh /home/user/miner1.sh"
Code:
user@linuxcoin:~$ export DISPLAY=`cat /home/user/.display`
user@linuxcoin:~$ pc=`ps waxuf | grep miner1.sh -c`
user@linuxcoin:~$ ld=`aticonfig --odgc --adapter=0 | grep "GPU load" | cut -c 30-35 | cut -d % -f 1`
aticonfig: This program must be run as root when no X server is active
user@linuxcoin:~$ if [ $pc -lt "2" ] || [ $ld -lt "50" ] ; then
>  kill `ps -ef | grep miner1 | grep -v grep | awk '{print $2}'`
>  lxterminal --title miner1 --command sh /home/user/miner1.sh &
>  date +"%D %r miner1 restarted" >> /home/user/cron_job.log
> fi
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
[1] 3964
user@linuxcoin:~$ pc=`ps waxuf | grep miner2.sh -c`

(lxterminal:3964): Gtk-WARNING **: cannot open display:
[1]+  Exit 1                  lxterminal --title miner1 --command sh /home/user/miner1.sh
user@linuxcoin:~$ ld=`aticonfig --odgc --adapter=1 | grep "GPU load" | cut -c 30-35 | cut -d % -f 1`
aticonfig: This program must be run as root when no X server is active
user@linuxcoin:~$ if [ $pc -lt "2" ] || [ $ld -lt "50" ] ; then
>  kill `ps -ef | grep miner2 | grep -v grep | awk '{print $2}'`
>  lxterminal --title miner2 --command sh /home/user/miner2.sh &
>  date +"%D %r miner2 restarted" >> /home/user/cron_job.log
> fi
bash: [: -lt: unary operator expected
user@linuxcoin:~$ pc=`ps waxuf | grep miner3.sh -c`
user@linuxcoin:~$ ld=`aticonfig --odgc --adapter=2 | grep "GPU load" | cut -c 30-35 | cut -d % -f 1`
aticonfig: This program must be run as root when no X server is active
user@linuxcoin:~$ if [ $pc -lt "2" ] || [ $ld -lt "50" ] ; then
>  kill `ps -ef | grep miner3 | grep -v grep | awk '{print $2}'`
>  lxterminal --title miner3 --command sh /home/user/miner3.sh &
>  date +"%D %r miner3 restarted" >> /home/user/cron_job.log
> fi

?? not sure if im doing this right

thanks for the help


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 21, 2011, 09:59:55 AM
That's weird. I don't get that message. Try running the aticonfig line as root.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Reckman on July 22, 2011, 01:36:10 AM
Code:
root@linuxcoin:/home/user# export DISPLAY=`cat /home/user/.display`
root@linuxcoin:/home/user# pc=`ps waxuf | grep miner1.sh -c`
root@linuxcoin:/home/user# ld=`aticonfig --odgc --adapter=0 | grep "GPU load" | cut -c 30-35 | cut -d % -f 1`
root@linuxcoin:/home/user# if [ $pc -lt "2" ] || [ $ld -lt "50" ] ; then
>  kill `ps -ef | grep miner1 | grep -v grep | awk '{print $2}'`
>  lxterminal --title miner1 --command sh /home/user/miner1.sh &
>  date +"%D %r miner1 restarted" >> /home/user/cron_job.log
> fi
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
[1] 3668
root@linuxcoin:/home/user#
(lxterminal:3668): Gtk-WARNING **: cannot open display:


I tried a fresh install...still doesn't want to work, using the default restart script.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 22, 2011, 02:43:59 PM
Are you doing this remotely over ssh or with a keyboard and monitor physically at that machine?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: brunoshady on July 22, 2011, 03:42:51 PM
yanz, give me a help here please..

I followed you guide, but using ubuntu, and everything gone fine, except the scripts parts...



I've created the scripts that you asked, but when I run them, the terminal screen just popup and close...


for example, I've created the start.sh script with the following code

Code:
#!/bin/bash
sleep 4
gnome-terminal --title GPU0 --command "sh /home/corelinux1/gpu0.sh"
gnome-terminal --title GPU1 --command "sh /home/corelinux1/gpu1.sh"

and the gpu0 and gpu1.sh on the same location, but when I run this script, I get the sleep time and then the bot miner scripts popup and close



ps, the code for the miner

Code:
#!/bin/bash
cd ~/poclbm/
./poclbm.py user:pass@blablabla#serv1 --frames=15 --device=0 --worksize=128 --vectors --tolerance=1 --failback=3


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Reckman on July 22, 2011, 05:24:57 PM
Are you doing this remotely over ssh or with a keyboard and monitor physically at that machine?

Plugged in with keyboard and monitor, I can try over ssh w.o monitor if you think tht might help


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 23, 2011, 04:30:29 AM
yanz, give me a help here please..

I followed you guide, but using ubuntu, and everything gone fine, except the scripts parts...



I've created the scripts that you asked, but when I run them, the terminal screen just popup and close...


for example, I've created the start.sh script with the following code

Code:
#!/bin/bash
sleep 4
gnome-terminal --title GPU0 --command "sh /home/corelinux1/gpu0.sh"
gnome-terminal --title GPU1 --command "sh /home/corelinux1/gpu1.sh"

and the gpu0 and gpu1.sh on the same location, but when I run this script, I get the sleep time and then the bot miner scripts popup and close



ps, the code for the miner

Code:
#!/bin/bash
cd ~/poclbm/
./poclbm.py user:pass@blablabla#serv1 --frames=15 --device=0 --worksize=128 --vectors --tolerance=1 --failback=3
have you tried running sh /home/corelinux1/gpu0.sh in the terminal manually?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 23, 2011, 04:32:23 AM
Are you doing this remotely over ssh or with a keyboard and monitor physically at that machine?

Plugged in with keyboard and monitor, I can try over ssh w.o monitor if you think tht might help
Well I googled the error and it seems to be from not having a physical monitor attached which is not your case. Have you tested that aticonfig properly installed and such? Check to see that everything is working manually.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Reckman on July 23, 2011, 08:24:49 PM
Well, the miners work fine. Im not sure what else it could be. How would I test that? Is there a way to start an x server?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 25, 2011, 01:16:27 AM
Well, the miners work fine. Im not sure what else it could be. How would I test that? Is there a way to start an x server?
I'm not quite sure. I'm not great with linux...this thread was just what I found to be working with a stock LinuxCoin install. Which evidently doesn't work for everyone. What's your hardware specs?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Reckman on July 25, 2011, 02:01:24 AM
ASRock 890gx MOBO, Athlon x2 250, 2x1gb ddr3, 3x 5850s, 900w PSU...basic mining stuff

Thanks for trying I guess. I'm posting in the linux coin thread maybe they will know a little better what the problem is


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: brunoshady on July 25, 2011, 05:55:37 AM
yanz, give me a help here please..

I followed you guide, but using ubuntu, and everything gone fine, except the scripts parts...



I've created the scripts that you asked, but when I run them, the terminal screen just popup and close...


for example, I've created the start.sh script with the following code

Code:
#!/bin/bash
sleep 4
gnome-terminal --title GPU0 --command "sh /home/corelinux1/gpu0.sh"
gnome-terminal --title GPU1 --command "sh /home/corelinux1/gpu1.sh"

and the gpu0 and gpu1.sh on the same location, but when I run this script, I get the sleep time and then the bot miner scripts popup and close



ps, the code for the miner

Code:
#!/bin/bash
cd ~/poclbm/
./poclbm.py user:pass@blablabla#serv1 --frames=15 --device=0 --worksize=128 --vectors --tolerance=1 --failback=3
have you tried running sh /home/corelinux1/gpu0.sh in the terminal manually?

yes, it works actually...

but when I double click the .sh file, it gives me error... =/

what should I do?




and how can I make the autostart at boot part? didn't work here your guide....








Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 25, 2011, 11:50:18 AM
I don't think you can run those by double clicking...
The autostart worked for me...
argg linux  >:(

Has anybody else (besides me) gotten it to work?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: pixilated8 on July 25, 2011, 12:55:40 PM
I don't think you can run those by double clicking...
The autostart worked for me...
argg linux  >:(

Has anybody else (besides me) gotten it to work?

I used this guide, tweaked for my specific hardware...
http://forum.bitcoin.org/index.php?topic=7374.msg248025#msg248025 (http://forum.bitcoin.org/index.php?topic=7374.msg248025#msg248025)


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Reckman on July 25, 2011, 09:52:46 PM
Yanz, I found the solution maybe you can update your guide,

I simply added the following to my start miner script.

xhost +
echo $DISPLAY > /home/user/.display


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: brunoshady on July 26, 2011, 12:53:52 AM
nvm, i did it (this problem) =p


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: brunoshady on July 26, 2011, 02:05:56 AM
ok guys, help me out here with the autostart problem..

I have 5 scripts that need to be executed on the system boot.


start.sh:
Code:
#!/bin/bash
sleep 20
gnome-terminal --title gpu.overclock --command "sh /home/corelinux1/gpu.overclock.sh"
gnome-terminal --title gpu0.miner --geometry=+0+0 --command "sh /home/corelinux1/gpu0.miner.sh"
gnome-terminal --title gpu1.miner --geometry=-0+0 --command "sh /home/corelinux1/gpu1.miner.sh"
gnome-terminal --title gpu0.fan --geometry=+0-0 --command "sh /home/corelinux1/gpu0.fan.sh"
gnome-terminal --title gpu1.fan --geometry=-0-0 --command "sh /home/corelinux1/gpu1.fan.sh"


so this start.sh, when executed from the terminal, as "sh /home/corelinux1/start.sh", everything goes fine, all 5 scripts are executed, the miners starts fine, the fans to, etc etc, except to the fact that the terminal where I executed didn't close itself (I want that)


so I added the command "sh /home/corelinux1/start.sh" at the Startup Applications on System Settings (Ubuntu 11), but when the system goes up, every command from the script (execute the others scripts) is executed only if the previous script is closed, AND the miner scripts gives errors of pypopencl include (don't know why)...

the gpu.overclock.sh is executed, and then, the gpu0.miner.sh is only executed when the gpu.overlock.sh closes itself.. so the gpu0.miner.sh is executed and gives the include error, so, it closes itself too, making the gpu1.miner.sh execute and giving the same error... then when it closes, the gpu0.fan.sh is executed, but it don't give any errors, so it stays running and the gpu1.fan.sh is not executed at all, or only if I close the gpu0.fan terminal...


what a fuck should I do? this is making me crazy!!!

and sorry if it couldn't be more specific, but please help me out here...



ps:
oh, and I did another script called autostart.sh, with "sh /home/corelinux1/start.sh" on it, and replaced with the start.sh command on the Startup Applications, but it happens the same thing...





Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Reckman on July 26, 2011, 10:39:43 PM
@bruno

Make your own thread, this isn't ubuntu 11 help


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 27, 2011, 03:47:30 AM
I don't think you can run those by double clicking...
The autostart worked for me...
argg linux  >:(

Has anybody else (besides me) gotten it to work?

I used this guide, tweaked for my specific hardware...
http://forum.bitcoin.org/index.php?topic=7374.msg248025#msg248025 (http://forum.bitcoin.org/index.php?topic=7374.msg248025#msg248025)
That's what I based this guide off of. Look in the first post...I linked it.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 27, 2011, 03:49:16 AM
Yanz, I found the solution maybe you can update your guide,

I simply added the following to my start miner script.

xhost +
echo $DISPLAY > /home/user/.display

Huh weird...I originally had this but it caused and error message and I deleted it and it still works. I guess I still need it, thanks for sorting this out.


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: Yanz on July 27, 2011, 03:52:42 AM
so this start.sh, when executed from the terminal, as "sh /home/corelinux1/start.sh", everything goes fine, all 5 scripts are executed, the miners starts fine, the fans to, etc etc, except to the fact that the terminal where I executed didn't close itself (I want that)

I think it's supposed to be running, you can't kill it without killing the program running inside...
but yeah, Sorry I can't really help...I don't run ubuntu


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: ahitman on September 07, 2011, 04:32:53 PM
Can you help me add another feature to these scripts? I have another script running on the computer, and sometimes it crashes. Is there any way to have this script restart it without using the GPU workload as a trigger? Is there a command that checks if another script is running?


Title: Re: [Guide]How to setup an automated headless LinuxCoin mining rig + watchdog
Post by: pixilated8 on September 07, 2011, 05:47:44 PM
You can create another script that runs every minute or 10 minutes to monitor.  For example:
Code:
#!/bin/bash

WHAT="phoenix"
CMD=`sudo ps -ef | grep -v grep | grep ${WHAT} | wc | awk '{print $1}'`

if [ ${CMD} -le 0 ]; then
  echo "stopped running.  restart here."
  exit 1
else
  echo "it's running.  no need to do anything."
fi
exit 0
This will look for a running instance of phoenix.  Of course, if you have more than one instance, you may have to fine tune what you are searching for to make it unique.  I have something similar that checks to make sure my miners are running.  And if it doesn't find it, the miner gets restarted.