[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: script to run screen with multiple telnet windows?

From: Germán Gutiérrez
Subject: Re: script to run screen with multiple telnet windows?
Date: Tue, 20 Jun 2006 09:03:30 -0300


I did this test:
screen -dmS test -t one

in another xterm / console, attach it with
screen -rd test

you can add screen sessions to it doing:
screen -S test -X screen -t two

and send commands with:
screen -S test -X at one stuff "ls `echo -ne '\015'`"

For the moment, my main problem is doing this in a detached session.

If you have X maybe you can:

nohup xterm -e "screen -S test -t one" &
sleep 2
screen -S test -X at one stuff "ls `echo -ne '\015'`"
sleep 1
screen -S test -X screen -t two

Hope you find this useful.

On 6/19/06, address@hidden <address@hidden> wrote:
Sam Cramer wrote:
> I'm trying to write a script to start a screen session with multiple
> telnet windows to a terminal server.  The name of the terminal server
> varies, as does the number of windows, so this isn't something I can
> do by just adding some lines to my .screenrc.
> I tried creating a screen session and then repeatedly sending it
> commands using -X as follows
> screen -S screen_cons -X screen -t node$i $i telnet $tsv 20$i
> where $i is the terminal server port number and $tsv is the terminal
> server hostname.
> Unfortunately, the screen -X commands silently fail.  If I remove the
> trailing telnet clause, the windows are created (without the telnet
> commands, of course).
> I also tried synthesizing a .screenrc file, which I stored in a temp
> file and supplied to screen using the "-c" command.  That worked OK,
> save for the fact that screen seems to want to have the .screenrc file
> present when reconnecting to the session. This prevents me from
> deleting the temp file in the script and I'd really like to avoid
> having lots of old screenrc temp files lying around.
> Does anyone have any suggestions on how to solve this problem?
> Thanks,
> Sam

Maybe not as elegant, but you could write a script that does the following:
1. Figure out the name of the server and number of windows you need
2. Write that info as screen commands into a file, like .screen-terms
3. Include .screen-terms in your .screenrc
4. Launch screen

This way, you'll be able to dynamically alter the configuration without
messing with anything else you might have in the .screenrc file.

Not pretty, but it should work.

screen-users mailing list


FOX News gives you both sides of every story: the President's side, and the Vice President's side.
reply via email to

[Prev in Thread] Current Thread [Next in Thread]