Bitcoin Forum
December 05, 2016, 12:38:54 PM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Linux "screen" question with cgminer  (Read 4515 times)
QuantumFoam
Full Member
***
Offline Offline

Activity: 130


View Profile
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.
1480941534
Hero Member
*
Offline Offline

Posts: 1480941534

View Profile Personal Message (Offline)

Ignore
1480941534
Reply with quote  #2

1480941534
Report to moderator
1480941534
Hero Member
*
Offline Offline

Posts: 1480941534

View Profile Personal Message (Offline)

Ignore
1480941534
Reply with quote  #2

1480941534
Report to moderator
1480941534
Hero Member
*
Offline Offline

Posts: 1480941534

View Profile Personal Message (Offline)

Ignore
1480941534
Reply with quote  #2

1480941534
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480941534
Hero Member
*
Offline Offline

Posts: 1480941534

View Profile Personal Message (Offline)

Ignore
1480941534
Reply with quote  #2

1480941534
Report to moderator
thirdlight
Sr. Member
****
Offline Offline

Activity: 281



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

Activity: 130


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

Cool, I'll give it a try and see if it works.
QuantumFoam
Full Member
***
Offline Offline

Activity: 130


View Profile
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.
Proofer
Sr. Member
****
Offline Offline

Activity: 251


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: 281



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

Activity: 130


View Profile
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.
Pages: [1]
  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!