Bitcoin Forum

Bitcoin => Mining support => Topic started by: Reckman on July 25, 2011, 02:08:05 AM



Title: [Solved] Help Restarting Miners in Linuxcoin
Post by: Reckman on July 25, 2011, 02:08:05 AM
Been having trouble restarting stopped miners with linux coin, will pay for solution to this problem (i just need miners to restart when crashed/stuck), currently running the following:

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
pc=`ps waxuf | grep miner3.sh -c`
ld=`aticonfig --odgc --adapter=2 | 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

with the following errors

Code:
user@linuxcoin:~$ sh  /home/user/restart.sh
aticonfig: This program must be run as root when no X server is active
kill: 9: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or
kill -l [exitstatus]
/home/user/restart.sh: 9: cannot create /home/user/cron_job.log: Permission denied

(lxterminal:3517): Gtk-WARNING **: cannot open display:
aticonfig: This program must be run as root when no X server is active
[: 16: -lt: unexpected operator
aticonfig: This program must be run as root when no X server is active
[: 23: -lt: unexpected operator

and in root

Code:
root@linuxcoin:/home/user# sh restart.sh
kill: 9: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or
kill -l [exitstatus]

(lxterminal:3594): Gtk-WARNING **: cannot open display:
[: 16: -lt: unexpected operator
[: 23: -lt: unexpected operator


Title: Re: [.5btc bounty] Help Restarting Miners in Linuxcoin
Post by: Kermee on July 25, 2011, 02:33:11 AM
I can give you a general idea:

1. Put 'DISPLAY=:0' in front of all of your 'aticonfig' commands. Example:

Code:
ld=`aticonfig --odgc --adapter=0 | grep "GPU load" | cut -c 30-35 | cut -d % -f 1`

Should be:

Code:
ld=`DISPLAY=:0 aticonfig --odgc --adapter=0 | grep "GPU load" | cut -c 30-35 | cut -d % -f 1`

2. This error:

Code:
/home/user/restart.sh: 9: cannot create /home/user/cron_job.log: Permission denied

Is probably occurring since it looks like you ran it as 'root' once so cron_job.log is owned by 'root' now.  You can fix it by running:

Code:
sudo chown user /home/user/cron_job.log

3. This error:
Code:
kill: 9: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or
kill -l [exitstatus]

Actually looks right if it's not finding one of your miner's running since the output of the awk from ps -ef would be empty.  You're calling it 3 times.  Do you really have 3 miners in your rig? -- If you do and still see that error, it's probably fine.  That can occur if a miner is already 'turned' off.

Cheers,
Kermee


Title: Re: [.5btc bounty] Help Restarting Miners in Linuxcoin
Post by: Reckman on July 25, 2011, 02:42:50 AM
Yes 3 cards, 3 miners

Its not restarting the miners though...applied your changes fixed the cron job error...but still broke :)

It is logging that it restarts the miners

Code:
user@linuxcoin:~$ sh  /home/user/restart.sh
kill: 9: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or
kill -l [exitstatus]

(lxterminal:3919): Gtk-WARNING **: cannot open display:
aticonfig: This program must be run as root when no X server is active
kill: 16: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or
kill -l [exitstatus]

(lxterminal:3934): Gtk-WARNING **: cannot open display:
aticonfig: This program must be run as root when no X server is active
kill: 23: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or
kill -l [exitstatus]
user@linuxcoin:~$
(lxterminal:3949): Gtk-WARNING **: cannot open display:



Title: Re: [.5btc bounty] Help Restarting Miners in Linuxcoin
Post by: Kermee on July 25, 2011, 02:46:58 AM
Paste the contents of /home/user/miner1.sh for me.   You can remove the pool info, creds, etc.

Cheers,
Kermee


Title: Re: [.5btc bounty] Help Restarting Miners in Linuxcoin
Post by: Reckman on July 25, 2011, 02:48:16 AM
Code:
#!/bin/bash
cd /opt/miners/phoenix
./phoenix.py -u http://xx@gmail.com_bottom:pass@pit.deepbit.net:8332/ -q 7 -k phatk BFI_INT VECTORS FASTLOOP=false AGGRESSION=7 DEVICE=0

The bootup script calls these shell files, and they work fine, opening each miner in a sep terminal named after the miner


Title: Re: [.5btc bounty] Help Restarting Miners in Linuxcoin
Post by: Kermee on July 25, 2011, 02:54:40 AM
Change each minerX.sh to (of course incrementing DEVICE=0 through 2) this:

Code:
#!/bin/bash
cd /opt/miners/phoenix && ./phoenix.py -u http://xx@gmail.com_bottom:pass@pit.deepbit.net:8332/ -q 7 -k phatk BFI_INT VECTORS FASTLOOP=false AGGRESSION=7 DEVICE=0

Your restart.sh should look like this:

Code:
#!/bin/bash
export DISPLAY=`cat /home/user/.display`
pc=`ps waxuf | grep miner1.sh -c`
ld=`DISPLAY=:0 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=`DISPLAY=:0 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
pc=`ps waxuf | grep miner3.sh -c`
ld=`DISPLAY=:0 aticonfig --odgc --adapter=2 | 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

If the 'DISPLAY=:0' isn't fixing this:

Code:
(lxterminal:XXXX): Gtk-WARNING **: cannot open display: 
aticonfig: This program must be run as root when no X server is active

Double-check to make sure that X is running. X might of crashed...

Cheers,
Kermee



Title: Re: [.5btc bounty] Help Restarting Miners in Linuxcoin
Post by: Kermee on July 25, 2011, 03:00:49 AM
Run this for me to:

Code:
`cat /home/user/.display`

Since I just noticed you have an export DISPLAY on it...

Cheers,
Kermee


Title: Re: [.5btc bounty] Help Restarting Miners in Linuxcoin
Post by: Reckman on July 25, 2011, 03:02:08 AM
How do i check on X server? could i start it with the script?

Sorry im linux newb. Still getting similar output, below with one miner turned off

Code:
 user@linuxcoin:~$ sh  /home/user/restart.sh
kill: 9: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or
kill -l [exitstatus]

(lxterminal:4169): Gtk-WARNING **: cannot open display:

Run this for me to:

Code:
`cat /home/user/.display`

Since I just noticed you have an export DISPLAY on it...

Cheers,
Kermee

ran this, no output...restart.sh still giving same output


Title: Re: [.5btc bounty] Help Restarting Miners in Linuxcoin
Post by: Kermee on July 25, 2011, 03:20:20 AM
How do i check on X server? could i start it with the script?

Code:
ps -ef | grep X | grep -v grep

Tell me what the output is.

Cheers,
Kermee


Title: Re: [.5btc bounty] Help Restarting Miners in Linuxcoin
Post by: Reckman on July 25, 2011, 03:23:28 AM
Ran it Once with all miners running, then restart.sh, then closed a miner and repeated.  Thanks for you help, really appreciate it.


Code:
user@linuxcoin:~$ ps -ef | grep X | grep -v grep
root      4286  4278 14 03:21 tty7     00:00:05 /usr/bin/X :0 -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7
user      4326  4278  0 03:21 ?        00:00:00 /usr/bin/lxsession -s LXDE -e LXDE
user      4378  4326  1 03:21 ?        00:00:00 lxpanel --profile LXDE
user      4380  4326  1 03:21 ?        00:00:00 pcmanfm --desktop --profile LXDE
user@linuxcoin:~$ sh  /home/user/restart.sh
user@linuxcoin:~$ sh  /home/user/restart.sh
kill: 9: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or
kill -l [exitstatus]

(lxterminal:4566): Gtk-WARNING **: cannot open display:
user@linuxcoin:~$
(lxterminal:4581): Gtk-WARNING **: cannot open display:

user@linuxcoin:~$ ps -ef | grep X | grep -v grep
root      4286  4278 11 03:21 tty7     00:00:06 /usr/bin/X :0 -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7
user      4326  4278  0 03:21 ?        00:00:00 /usr/bin/lxsession -s LXDE -e LXDE
user      4378  4326  1 03:21 ?        00:00:00 lxpanel --profile LXDE
user      4380  4326  0 03:21 ?        00:00:00 pcmanfm --desktop --profile LXDE
user@linuxcoin:~$


Title: Re: [.5btc bounty] Help Restarting Miners in Linuxcoin
Post by: Kermee on July 25, 2011, 03:26:20 AM
Run this just to make sure:

Code:
ps -ef | grep phoenix.py | grep -v grep

Or you can just do a line-count:

Code:
ps -ef | grep phoenix.py | grep -v grep | wc -l

You should get an output of '3'... Which means 3 phoenix.py miners are running.

Cheers,
Kermee


Title: Re: [.5btc bounty] Help Restarting Miners in Linuxcoin
Post by: Reckman on July 25, 2011, 03:34:14 AM
with one miner off


user@linuxcoin:~$ ps -ef | grep phoenix.py | grep -v grep
user      4685  4684  0 03:24 pts/2    00:00:03 /usr/bin/python ./phoenix.py -u http://reganreckman@gmail.com_bottom:regan10@pit.deepbit.net:8332/ -q 7 -k phatk BFI_INT VECTORS FASTLOOP=false AGGRESSION=11 DEVICE=1
user      4687  4686  0 03:24 pts/3    00:00:03 /usr/bin/python ./phoenix.py -u http://reganreckman@gmail.com_bottom:regan10@pit.deepbit.net:8332/ -q 7 -k phatk BFI_INT VECTORS FASTLOOP=false AGGRESSION=11 DEVICE=2
user@linuxcoin:~$ ps -ef | grep phoenix.py | grep -v grep| wc -l
2
user@linuxcoin:~$


Title: Re: [.5btc bounty] Help Restarting Miners in Linuxcoin
Post by: TripHammer on July 25, 2011, 05:20:00 AM
Correct me if I'm wrong, but you also have the auto.sh file that runs after boot?

Code:
#!/bin/bash

xhost +
echo $DISPLAY > /home/user/.display
lxterminal --command "/usr/local/bin/startminers.sh"

I think this might help Kermee debug the problem, I'm having it too, whenever I've seen xhost + used it is usually always after an

Code:
export DISPLAY=:0


Title: Re: [.5btc bounty] Help Restarting Miners in Linuxcoin
Post by: Kermee on July 25, 2011, 05:40:27 AM
with one miner off


user@linuxcoin:~$ ps -ef | grep phoenix.py | grep -v grep
user      4685  4684  0 03:24 pts/2    00:00:03 /usr/bin/python ./phoenix.py -u http://reganreckman@gmail.com_bottom:regan10@pit.deepbit.net:8332/ -q 7 -k phatk BFI_INT VECTORS FASTLOOP=false AGGRESSION=11 DEVICE=1
user      4687  4686  0 03:24 pts/3    00:00:03 /usr/bin/python ./phoenix.py -u http://reganreckman@gmail.com_bottom:regan10@pit.deepbit.net:8332/ -q 7 -k phatk BFI_INT VECTORS FASTLOOP=false AGGRESSION=11 DEVICE=2
user@linuxcoin:~$ ps -ef | grep phoenix.py | grep -v grep| wc -l
2
user@linuxcoin:~$


Hrm. This is strange.

Change miner0.sh to this:

Code:
cd /opt/miners/phoenix && /opt/miners/phoenix/phoenix.py -u http://reganreckman@gmail.com_bottom:regan10@pit.deepbit.net:8332/ -q 7 -k phatk BFI_INT VECTORS FASTLOOP=false AGGRESSION=7 DEVICE=0

Kill miner0, and then manually run the script by calling:

Code:
/home/user/miner1.sh

And tell me what happens... I think 'restart.sh' is fine... It's your minerX.sh scripts which are the problem.

Cheers,
Kermee



Title: Re: [.5btc bounty] Help Restarting Miners in Linuxcoin
Post by: gopher on July 25, 2011, 11:53:36 AM

I would like to take a bit different approach to this. I just posted a detailed step-by-step guide on howto mine in linuxcoin headless. In a variation of the startminers.sh script, I would propose using timed loop to restart all phoenix.py processes once every 24 hrs.

Will this work for you?

Code:

#!/bin/bash

while true

cd /opt/miners/phoenix/

./phoenix.py -u http://aaNcBG:TYKeSg@bitcoins.lc:8080 -k poclbm DEVICE=0 BFI_INT VECTORS AGGRESSION=8 &

sleep 2

./phoenix.py -u http://gxPrZG:kvEBzd@bitcoins.lc:8080 -k poclbm DEVICE=1 BFI_INT VECTORS AGGRESSION=8 &

sleep 2

./phoenix.py -u http://FBpQqd:KUKuGd@bitcoins.lc:8080 -k poclbm DEVICE=2 BFI_INT VECTORS AGGRESSION=8 &

sleep 2

./phoenix.py -u http://PfyxvQ:mWQfCM@bitcoins.lc:8080 -k poclbm DEVICE=3 BFI_INT VECTORS AGGRESSION=8

sleep 86400

killall phoenix.py

done





Title: Re: [.5btc bounty] Help Restarting Miners in Linuxcoin
Post by: Reckman on July 25, 2011, 01:10:46 PM
Will try that when I get home kermee, I feel the minerX.sh script is fine, because the start.sh script calls them, and they load the miners fine, also upping the bounty to 1btc, I did not anticipate it would be this difficult to fix.

@gopher, that seems like an inefficient solution, the restart script cycles every minute

@triphammer, no I followed this guide http://forum.bitcoin.org/index.php?topic=29021.0


Title: Re: [1btc bounty] Help Restarting Miners in Linuxcoin
Post by: Reckman on July 25, 2011, 09:51:38 PM
Added this to my start miner script, seemed to do the trick, this is now working correctly

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

Karmee + Xtriphammer post addresses for donations


Title: Re: [1btc bounty] Help Restarting Miners in Linuxcoin
Post by: Kermee on July 25, 2011, 10:32:29 PM
Added this to my start miner script, seemed to do the trick, this is now working correctly

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

Karmee + Xtriphammer post addresses for donations

Sent to you in a PM.

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

Duh... Forgot about xhost... I just assumed those two would be already persistent in the environment.

Keep those miners mining!

Cheers,
Kermee


Title: Re: [Solved] Help Restarting Miners in Linuxcoin
Post by: gopher on July 26, 2011, 07:05:10 AM
@ Reckman

Do you mind posting the complete correct script, for the newbies?



Title: Re: [Solved] Help Restarting Miners in Linuxcoin
Post by: Reckman on July 26, 2011, 02:01:55 PM
http://forum.bitcoin.org/index.php?topic=29021.0

Just add xhost+  and the other line to startminers or autostart script


Title: Re: [Solved] Help Restarting Miners in Linuxcoin
Post by: TripHammer on July 26, 2011, 04:55:58 PM
Glad I could help, sent in PM