On Fri, Jun 16, 2006 at 09:29:06AM -0700, 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).

This is surprising, I don't see why the telnet command fails.
But why don't you use the builtin telnet?

screen -S screen_cons -X screen -t node$i $i //telnet $tsv 20$i

Maybe you also want to turn on "zombie" mode for a console screen,
so you can still look at the window if the telnet connection dies.

> 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?

You can also write a tmp file and then use

screen -S screen_cons -X source <tmpfile>

to source it. You won't have the reattach problem this way.

Cheers,
  Michael.

-- 
Michael Schroeder           [EMAIL PROTECTED]
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}


_______________________________________________
screen-users mailing list
screen-users@gnu.org
http://lists.gnu.org/mailman/listinfo/screen-users

Reply via email to