Bitcoin Forum
December 11, 2016, 12:24:53 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1] 2 »  All
  Print  
Author Topic: [Solved] Help Restarting Miners in Linuxcoin  (Read 3185 times)
Reckman
Hero Member
*****
Offline Offline

Activity: 712


View Profile
July 25, 2011, 02:08:05 AM
 #1

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
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481415893
Hero Member
*
Offline Offline

Posts: 1481415893

View Profile Personal Message (Offline)

Ignore
1481415893
Reply with quote  #2

1481415893
Report to moderator
1481415893
Hero Member
*
Offline Offline

Posts: 1481415893

View Profile Personal Message (Offline)

Ignore
1481415893
Reply with quote  #2

1481415893
Report to moderator
1481415893
Hero Member
*
Offline Offline

Posts: 1481415893

View Profile Personal Message (Offline)

Ignore
1481415893
Reply with quote  #2

1481415893
Report to moderator
Kermee
Full Member
***
Offline Offline

Activity: 140



View Profile
July 25, 2011, 02:33:11 AM
 #2

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

Reckman
Hero Member
*****
Offline Offline

Activity: 712


View Profile
July 25, 2011, 02:42:50 AM
 #3

Yes 3 cards, 3 miners

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

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:

Kermee
Full Member
***
Offline Offline

Activity: 140



View Profile
July 25, 2011, 02:46:58 AM
 #4

Paste the contents of /home/user/miner1.sh for me.   You can remove the pool info, creds, etc.

Cheers,
Kermee

Reckman
Hero Member
*****
Offline Offline

Activity: 712


View Profile
July 25, 2011, 02:48:16 AM
 #5

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
Kermee
Full Member
***
Offline Offline

Activity: 140



View Profile
July 25, 2011, 02:54:40 AM
 #6

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


Kermee
Full Member
***
Offline Offline

Activity: 140



View Profile
July 25, 2011, 03:00:49 AM
 #7

Run this for me to:

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

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

Cheers,
Kermee

Reckman
Hero Member
*****
Offline Offline

Activity: 712


View Profile
July 25, 2011, 03:02:08 AM
 #8

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
Kermee
Full Member
***
Offline Offline

Activity: 140



View Profile
July 25, 2011, 03:20:20 AM
 #9

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

Reckman
Hero Member
*****
Offline Offline

Activity: 712


View Profile
July 25, 2011, 03:23:28 AM
 #10

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:~$
Kermee
Full Member
***
Offline Offline

Activity: 140



View Profile
July 25, 2011, 03:26:20 AM
 #11

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

Reckman
Hero Member
*****
Offline Offline

Activity: 712


View Profile
July 25, 2011, 03:34:14 AM
 #12

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:~$
TripHammer
Jr. Member
*
Offline Offline

Activity: 42


View Profile
July 25, 2011, 05:20:00 AM
 #13

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

Just in case Smiley 13AP8mCpruBQVtVWbQgYGSnBgGxe2g8ERe
Kermee
Full Member
***
Offline Offline

Activity: 140



View Profile
July 25, 2011, 05:40:27 AM
 #14

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


gopher
Full Member
***
Offline Offline

Activity: 135


View Profile
July 25, 2011, 11:53:36 AM
 #15


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



Reckman
Hero Member
*****
Offline Offline

Activity: 712


View Profile
July 25, 2011, 01:10:46 PM
 #16

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
Reckman
Hero Member
*****
Offline Offline

Activity: 712


View Profile
July 25, 2011, 09:51:38 PM
 #17

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
Kermee
Full Member
***
Offline Offline

Activity: 140



View Profile
July 25, 2011, 10:32:29 PM
 #18

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

gopher
Full Member
***
Offline Offline

Activity: 135


View Profile
July 26, 2011, 07:05:10 AM
 #19

@ Reckman

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

Reckman
Hero Member
*****
Offline Offline

Activity: 712


View Profile
July 26, 2011, 02:01:55 PM
 #20

http://forum.bitcoin.org/index.php?topic=29021.0

Just add xhost+  and the other line to startminers or autostart script
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!