mersenneforum.org  

Go Back   mersenneforum.org > Prime Search Projects > No Prime Left Behind

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

45916 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
http://gentoo-wiki.com/TIP_Using_screen

Here is the PuTTY for windows that I use
http://www.chiark.greenend.org.uk/~sgtatham/putty/

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

chdir
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)
#!/bin/sh

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
example:
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
I ♥ BOINC!
 
IronBits's Avatar
 
Oct 2002
Glendale, AZ. (USA)

3×7×53 Posts
Default

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.

#!/bin/bash

# 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 ))
then
echo " No existing SCREEN session to reattach to..."
exit
fi

echo ''
echo " CURRENT SESSIONS"
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 ]
then
echo -n " Reattach to session: "
read session
else
session=$1
fi


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

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

***************************************
Example:

./screens

CURRENT SESSIONS
------------------------
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
Reply

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 22:05.

Thu Dec 3 22:05:47 UTC 2020 up 18:17, 1 user, load averages: 1.54, 1.59, 1.65

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, 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.