0

I have built a custom embedded system using debian 6.0.

using /etc/inittab i have made several (8) processes running on different /dev/ttyX terminals, which i can switch between using Alt+FX key combination. the thing is using this setup i need to attach a keyboard/monitor to device and reboot it, to be able to operate on it, which is so undesirable. i know linux supports terminals through serial port and i have a couple of them on the device, but i need to have all these processes output in a single serial port terminal. i have found about screen utility for terminal multiplexing, but still not sure if this is the way to go, and the actual setup that needs to be done.

any experience or best practice on this scenario would be highly appreciated

dsolimano
  • 8,870
  • 3
  • 48
  • 63
aliz
  • 1
  • 1
  • Why wouldn't screen be the way to go? I think you would just need to use the commands screen and exec in your screenrc file, to make the processes start automatically, each in a separate screen window. I have never done this though. – Robin Green Mar 26 '11 at 08:55
  • thanks, but does screen have a functionality like respawn in /etc/inittab ? i need that. – aliz Mar 26 '11 at 10:32
  • I don't know, but you could get the same functionality easily by wrapping a simple shell script around the binaries. I suggest you post a followup question on StackOverflow if you want a quick answer on how to do that. – Robin Green Mar 26 '11 at 10:40
  • or is it possible to attach a screen window to a running process or terminal? – aliz Mar 26 '11 at 10:52
  • no, you have to start it within screen. – Robin Green Mar 26 '11 at 10:55
  • i think the code to respawn a process is `#!/bin/sh while [ 1 ]; do /bin/ls -l /home/znx done` perhaps with a signal handler to handle sigint – aliz Mar 26 '11 at 10:57
  • You probably want to put a sleep in there after the process ends, to avoid overloading the system if a process is repeatedly stillborn. – Robin Green Mar 26 '11 at 11:02
  • it would have been great if i could maintain the old way, while testing new way, but i cannot have multiple instances of those processes running concurrently. can screen **demultiplex** it's output into two terminals, one to /dev/tty1 and the other to /dev/ttyS0 – aliz Mar 26 '11 at 11:02
  • @aliz: Sure, you can run `screen -x` and attach the same screen in two terminals. – caf Mar 28 '11 at 04:04

3 Answers3

1

I strongly recommend using screen(1)'s hardstatus line; screen(1) can be pretty confusing without it, at least when you're trying to learn.

Some examples stolen from https://serverfault.com/questions/3740/what-are-useful-screenrc-settings

hardstatus lastline                                    
#hardstatus string '%{= mK}%-Lw%{= KW}%50>%n%f* %t%{= mK}%+Lw%< %{= kG}%-=%D %d %M %Y %c:%s%{-}'
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'

All those magic incantations might be a bit much to stomach; I had a nice set I used to love, but that hard drive is currently sitting on a shelf. Maybe hunt around a little bit to collect a few, and look for descriptions of them. :)

I recall needing both hardstatus lastline and hardstatus string ..., but I cannot recall the consequences of leaving off the lastline line.

Community
  • 1
  • 1
sarnold
  • 102,305
  • 22
  • 181
  • 238
1

What about the new Unicode aware multiplexer called Tmux which can be found on sourceforge.

See http://tmux.sourceforge.net

Jerry Jacobs
  • 195
  • 9
0

Many years ago there was "mscreen", originally from SCO Unix. I don't know if it's still avilable. Today there is the "GNU Screen" project:

http://www.gnu.org/software/screen/

Giuseppe Guerrini
  • 4,274
  • 17
  • 32