Bitcoin Forum
November 19, 2024, 11:52:57 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Linux "screen" question with cgminer  (Read 4763 times)
QuantumFoam (OP)
Full Member
***
Offline Offline

Activity: 200
Merit: 100


|Quantum|World's First Cloud Management Platform


View Profile WWW
February 06, 2012, 06:52:43 AM
 #1

I have cgminer set to start in a bash script which calls the program "screen" to do so. This works great except the very useful stats printout cgminer gives when exiting is lost since that instance of "screen" terminates. I'm sure there's a trivial way to either log this output when cgminer exits, or a command that can be sent to screen to have that "screen" instance remain displayed on the terminal when exiting cgminer? I'm still fairly green with linux and my searches and reading the man page have come up empty thus far.

|Quantum|World's First Cloud Management Platform on the Blockchain
thirdlight
Sr. Member
****
Offline Offline

Activity: 445
Merit: 250



View Profile
February 06, 2012, 07:10:27 AM
 #2

In my bash script, I have
Code:
screen -d -m -S miner
which starts screen & gives it a name ("miner")
and
Code:
screen -X -S miner screen -t x1 1
screen -X -S miner -p 1 stuff "cgminer -c cgminep
"
which adds a screen (called x1, with the index 1) to the screen called "miner" (like "ctrl-a c") and invokes cgminer (using config file 'cgminep') in it. You know the newline between 'cgminep' and ' " ' is deliberate, right?

Then I just
Code:
screen -r
and there it is.

Hope it helps.

QuantumFoam (OP)
Full Member
***
Offline Offline

Activity: 200
Merit: 100


|Quantum|World's First Cloud Management Platform


View Profile WWW
February 06, 2012, 08:17:51 AM
 #3

Cool, I'll give it a try and see if it works.

|Quantum|World's First Cloud Management Platform on the Blockchain
QuantumFoam (OP)
Full Member
***
Offline Offline

Activity: 200
Merit: 100


|Quantum|World's First Cloud Management Platform


View Profile WWW
February 06, 2012, 05:58:01 PM
 #4

Tested and it works, except the cgminer exit statistics lines above the top of the terminal get cut off and scrolling up doesn't help (it just shows the last prompt when I typed screen -r), so I can't see the entire stats printout.

|Quantum|World's First Cloud Management Platform on the Blockchain
Proofer
Member
**
Offline Offline

Activity: 266
Merit: 36


View Profile
February 07, 2012, 02:36:39 AM
 #5

Tested and it works, except the cgminer exit statistics lines above the top of the terminal get cut off and scrolling up doesn't help (it just shows the last prompt when I typed screen -r), so I can't see the entire stats printout.

First, another answer to your original post:  you can log cgminer's output to a file.  Here is the relevant portion of the script that I use to start cgminer:
Code:
#!/bin/bash
now="`date +%Y.%m.%d.%H.%M.%S`"
cd ~/miners/cgminer
DISPLAY=:0 cgminer -c cgminer.conf 2> logs/$now.log

It causes a log file with date and time as part of the file name to get cgminer's output.

As to the screen scrollback issue, see GNU Screen: Working with the Scrollback Buffer
thirdlight
Sr. Member
****
Offline Offline

Activity: 445
Merit: 250



View Profile
February 07, 2012, 08:14:56 AM
 #6

As to the screen scrollback issue, see ...
That's really helpful! I'm such a basic screen user, I never realised there was so much more  Grin

QuantumFoam (OP)
Full Member
***
Offline Offline

Activity: 200
Merit: 100


|Quantum|World's First Cloud Management Platform


View Profile WWW
February 07, 2012, 11:15:31 PM
 #7

Thanks for the info. I did attempt to redirect output of cgminer to a log file, but that did not work (it just logged the first xhost message and nothing after that). I would also just want it to log the exit stats anyway, not everything, as I am trying to minimize IO as much as possible since this is a USB stick (I already changed the disk scheduler method and mounted tmp to use RAM). I will try it again and see if it works, however. The default scrollback buffer size of 100 lines should be more than enough for cgminer's exit stats, I would think. Basically, everything above the current terminal screen (which is only 24 lines high) is cut off. I will change the buffer size but I suspect it isn't going to fix this particular problem.

|Quantum|World's First Cloud Management Platform on the Blockchain
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!