Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to get a 'Screen' with 4 tabs to split the screen into 4 regions.

I'm running 4 instances of bfgminer. One instance per USB Hardware miner. Unfortunately it has to be this way. So I'm trying to get all 4 outputs on 1 screen.

I am starting up screen with the following config file, to give me 4 tabs that I can switch between.

    screen -t  USB0
    select 0
    stuff "command /home/pi/Mining/bfgminer --scrypt -c miner.conf
    screen -t USB1
    select 1
    stuff "command /home/pi/Mining/bfgminer --scrypt -c miner.conf
    screen -t USB2
    select 2
    stuff "command /home/pi/Mining/bfgminer --scrypt -c miner.conf
    screen -t USB3
    select 3
    stuff "command /home/pi/Mining/bfgminer --scrypt -c miner.conf

    altscreen on
    term screen-256color                                          
    bind ','         prev                                                                  
    bind '.' next 
    #                                                                              
    #change the hardstatus settings to give an window list at the bottom of the    
    #screen, with the time and date and with the current window highlighted        
    hardstatus alwayslastline                                                      
    #hardstatus string '%{= kG}%-Lw%{= kW}%50> %n%f* %t%{= kG}%+Lw%< %{= kG}%-=%c:%
    hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%

I found it in an old post on here somewhere. And tweaked it a bit for my needs.

From reading the Screen man pages, I think that the 'Regions' function should allow me to get all 4 tabs split on 1 screen instead of having to use Ctrl+A, CTRL+, just to look at the next screen.

How can I get Screen to show all 4 instances of bfgminer, on one single screen?

I'm going to be using ssh to get onto my Pi and check the miners from time to time, and it'll be a lot easier with only 1 logon, and screen to run.

share|improve this question
    
if you can use tmux instead of screen –  Rabin Jul 13 at 8:01
    
Been looking at the tmux man pages. It seems like a clone of screen. How would i be able to get tmux to startup and run all 4 instances with 1 command/shell script? –  7hr08ik Jul 13 at 9:00
    
Well i found this - robots.thoughtbot.com/a-tmux-crash-course - Gonna have a read through and see if i can figure this out –  7hr08ik Jul 13 at 9:03

3 Answers 3

Rather than attempt to coax screen into merging the outputs I'd do the following.

  1. Change each bfgminer so that they log to their own file like so.

    command /home/pi/Mining/bfgminer --scrypt -c miner.conf | tee bfgminger1.log
    
  2. Then use the following tail command in a 5th screen so that I can watch the output from all 4 simultaneously.

    tail -f bfgminger{1..4}.log
    
share|improve this answer
    
That sounds like an option. But my only caveat would be that if need/want to alter some settings i will still have to ssh & screen into each bfgminer instance. Because im running things from my pi, im hoping to have screen autorun at boot, and show me all 4 screens –  7hr08ik Jul 13 at 8:58

I must recommend tmux in you case, I have my tmux-setup-script:

#!/bin/sh
tmux new-session -d -s rabin

tmux new-window -t rabin -n 'Server1' 'ssh root@10.x.x.x'
tmux new-window -t rabin -n 'Server2' 'ssh root@10.x.x.x'
tmux new-window -t rabin -n 'Server3' 'ssh root@10.x.x.x'
tmux new-window -t rabin -n 'Server4' 'ssh root@10.x.x.x'
tmux new-window -t rabin -n 'Server5' 'ssh root@10.x.x.x'

tmux select-window -t rabin:1
tmux -2 attach-session -t rabin

I also recommend you read the Arch wiki page for some nice option you can set in your tmux.conf file.

Edit:

You can split the same window into several panels,

# create a new session
tmux new-session -d -s XXX

 # will split the window horizontally
 tmux split-window -h -t XXX

 # will split the window vertically 
 tmux split-window    -t XXX

 # select the LEFT panel in the current window
 tmux select-pane -L  -t XXX
 tmux split-window    -t XXX
share|improve this answer
    
Can all of this be done through config file? So that its automatic –  7hr08ik Jul 13 at 11:05
    
you can put all this commands in a shell script, and run it, just like the first example. –  Rabin Jul 13 at 11:23
    
OK, so your saying....Run 4 instances on the Pi > Run tmux on my laptop > tell tmux to load 4 screens > each screen to ssh into the pi and load 'screen -d -r USB0' –  7hr08ik Jul 13 at 11:41
    
Or do i run tmux on the pi and ssh into it from my laptop? –  7hr08ik Jul 13 at 11:41
1  
Run tmux on the RPi and from there connect to each USB device, then each time you connect to the RPi, just run tmux att and it will attach to the session. –  Rabin Jul 13 at 13:19

For screen, the commands you want are split and focus next, which creates a new region and moves focus to it, respectively. Run each of them before starting a new process.

If you have the vertical patch, split -v will work too, and might give you a nicer layout.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.