View Single Post
Old 2008-07-13, 16:54   #1
IronBits's Avatar
Oct 2002
Glendale, AZ. (USA)

3·7·53 Posts
Default Using Screen to manage your clients/servers

Many of us are using Linux, and many are using multi-cores.
I have come up with a way to manage them using screen and PuTTY to to connect to a Linux box.

Here is the documentation on screen

Here is the PuTTY for windows that I use

Using PuTTY from a Windows box I create a shortcut like this

"C:\Program Files\PuTTY\putty.exe" ComputerName -l LoginID -pw P@ssword1!

Now I am at a shell prompt on the remote computer

Here is what I did to start 4 cores under Linux for nplb projects

1) create a file called .screenrc-nplb and put this in it (change your paths in the line that starts with chdir) (each line is a full line)
startup_message off
autodetach on
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]' # this should be all on one line

screen -t shell 0

chdir /home/ironbits/nplb/nplb1
screen -t nplb1 1 ./llrnet

chdir /home/ironbits/nplb/nplb2
screen -t nplb2 2 ./llrnet

chdir /home/ironbits/nplb/nplb3
screen -t nplb3 3 ./llrnet

chdir /home/ironbits/nplb/nplb4
screen -t nplb4 4 ./llrnet

2) Next create a file called screens-nplb (chmod 755)

screen -O -S nplb -c ~/.screenrc-nplb

To start 4 clients for nplb type ./screens-nplb

Using the above setup you will see 5 windows,
shell=0, client1=1, client2=2, client3=3, client4=4

To switch between client screens type ctrl-a # where # is the number of the window/client you want to view
ctrl-a 0 will take you to the window with shell prompt
ctrl-a 1 will take you to the first client window
ctrl-a 2 will take you to the second client window

now, type ctrl-a 0 to get to the shell window, then ctrl-a d to detach from screen
then type exit to get out of the PuTTY shell session (the clients will remain running)

Last fiddled with by IronBits on 2008-07-13 at 17:11
IronBits is offline   Reply With Quote