Go Back > Prime Search Projects > No Prime Left Behind

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

111310 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
Old 2008-07-13, 17:00   #2
IronBits's Avatar
Oct 2002
Glendale, AZ. (USA)

111310 Posts

Second part to reconnect to your screen

using the PuTTY shortcut above, get reconnected to your Linux box

create a new file called screens (chmod 755) and run ./screens and choose the number of the screen you want to attach to.


# filters the screen -ls output to show the sesssions
sessions=`screen -ls | sed -ne 's/[[:space:]]//' -ne 's/\((Attached)\|(Detached)\)// p'`
res=`echo "$sessions" | wc -w`

if (( $res == 0 ))
echo " No existing SCREEN session to reattach to..."

echo ''
echo " ------------------------"
#screen -ls | sed -ne 's/[[:space:]]//' -ne 's/\((Attached)\|(Detached)\)// p' | cat -n
echo "$sessions" | cat -n
echo " ------------------------"
echo ''

#if first argument is not specified, script will ask for number of screen

if [ -z $1 ]
echo -n " Reattach to session: "
read session

#attach to specified session
name=`screen -ls | sed -ne 's/[[:space:]]//' -ne 's/\((Attached)\|(Detached)\)// p' |
while read line
let "linenum += 1"
if [[ "$linenum" -eq "$session" ]]
echo $line

if [[ "$name" != "" ]]
screen -d -r "$name"
echo " Could not reattach to '$session'"



1 5159.nplb

Reattach to session:
type 1 and <enter>

To check each session type ctrl-a # (number of client window you want to view)
ctrl-a 0 (attach to the shell window)
ctrl-a d (detach from screen)
exit (close the PuTTY session)

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

Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
NFS@Home errors from clients pinhodecarlos NFS@Home 0 2015-09-30 14:20
Thin Clients moo Hardware 0 2006-11-14 06:30
MacOS X clients and PrimeNet schneelocke Software 9 2005-12-31 02:55
PRP/LLR clients OmbooHankvald Prime Sierpinski Project 11 2005-07-13 21:24
Factoring performance on different clients koekie Software 1 2003-10-16 14:35

All times are UTC. The time now is 07:56.

Thu Feb 25 07:56:38 UTC 2021 up 84 days, 4:07, 0 users, load averages: 1.69, 1.69, 1.60

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.