LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Creating a screen session in an existing session (https://www.linuxquestions.org/questions/linux-newbie-8/creating-a-screen-session-in-an-existing-session-518894/)

Frits of waterplant 01-13-2007 04:09 AM

Creating a screen session in an existing session
 
Hi,

You can create in a existing screen session a second window by pressing CTRL-A C, but how can you do that from command line?

Simon Bridge 01-13-2007 04:25 AM

ctrl-a c uses GNU Screen

"man screen"
screen [ -options ] [ cmd [ args ] ]

Also see article:
http://www.debian-administration.org/articles/34/print

Frits of waterplant 01-13-2007 05:06 AM

I think you misunderstood.

I would like to create a new GNU screen window in an existing GNU screen session from the command line, in stead of reattaching the existing screen session and pressing CTRL-A C.

If I start a second application in screen now, it will exist in a second session. So if you would execute

Code:

screen -ls
you would get as output:

Code:

There are several suitable screens on:
        3460.pts-0.vissekom    (Detached)
        3473.pts-0.vissekom    (Detached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.

I would like to have the two application running in the same session, as two windows. But I start these applications from a script. So I can't use any command keys to do it.

Frits of waterplant 01-18-2007 01:56 AM

Anybody???

bospaadje 01-18-2007 04:53 AM

i found the following section in the man page for screen:
Quote:

Originally Posted by man screen
"Thus,
if your ".screenrc" contains the lines

# example for .screenrc:
screen 1
screen -fn -t foobar -L 2 telnet foobar

screen creates a shell window (in window #1) and a window with a
TELNET connection to the machine foobar (with no flow-control
using the title "foobar" in window #2) and will write a logfile
("screenlog.2") of the telnet session."

This is documented under the 'screen' option, section 'Customization'. You can create a separate configuration file for your script and specify it with the screen -c file option. Judging from the manpage it's probably not possible to do this directly from the commandline, except by creating the conf file from the script using, for example,
Code:

echo "screen 1 some_command" > /folder/screenconf_script
echo "screen 2 some_other_command" >> /folder/screenconf_script
etc..

screen -c /folder/screenconf_script

and removing the file again at the end of the script.

I hope this helps you solve your problem.


All times are GMT -5. The time now is 08:17 PM.