[ILUG] screen reattach funny

Conor Daly conor.daly_ilug at cod.homelinux.org
Mon May 9 13:38:19 IST 2005


On Mon, May 09, 2005 at 11:41:57AM +0100 or so it is rumoured hereabouts, 
Niall O Broin thought:
> I've been trying to use screen's -R option which according to the man page
> 
> I suppose the question boils down to "Does screen not work as it should with 
> -R, or have I completely misunderstood the phrase 'attempts to resume the 
> first detached screen session it finds' ?"

My tests with screen (RH9, Screen version 3.09.13 (FAU) 5-Sep-02) comes
down to:

]$ screen (screen launches, <CTRL>+a,d to detach)
]$ screen (screen launches, <CTRL>+a,d to detach)

]$ screen -r
There are several suitable screens on:
        22726.pts-0.Hobbiton    (Detached)
        22769.pts-0.Hobbiton    (Detached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.

]$ screen -R
There are several suitable screens on:
        22726.pts-0.Hobbiton    (Detached)
        22769.pts-0.Hobbiton    (Detached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.

]$ screen -RR
  <one screen gets attached here, when I detach:>
There are several suitable screens on:
        22726.pts-0.Hobbiton    (Detached)
        22769.pts-0.Hobbiton    (Detached)
[detached]


  <attach one screen>

]$ screen -list
There are screens on:
        22726.pts-0.Hobbiton    (Attached)
        22769.pts-0.Hobbiton    (Detached)
2 Sockets in /tmp/uscreens/S-cdaly.

]$ screen -R
  <screen attaches, when I detach:>
[detached]

  <attach both screens>

]$ screen -list
There are screens on:
        22726.pts-0.Hobbiton    (Attached)
        22769.pts-0.Hobbiton    (Attached)
2 Sockets in /tmp/uscreens/S-cdaly.

]$ screen -r
There are screens on:
        22726.pts-0.Hobbiton    (Attached)
        22769.pts-0.Hobbiton    (Attached)
There is no screen to be resumed.

]$ screen -R
  <new screen starts, when I exit:>
There are screens on:
        22726.pts-0.Hobbiton    (Attached)
        22769.pts-0.Hobbiton    (Attached)
[screen is terminating]

]$ screen -RR
  <new screen starts, when I exit:>
There are screens on:
        22726.pts-0.Hobbiton    (Attached)
        22769.pts-0.Hobbiton    (Attached)
[screen is terminating]

]$ screen -dR
There are several suitable screens on:
        22726.pts-0.Hobbiton    (Attached)
        22769.pts-0.Hobbiton    (Attached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.

]$ screen -dRR
  <one screen gets detached and reattached here, when I detach:>
There are several suitable screens on:
        22726.pts-0.Hobbiton    (Attached)
        22769.pts-0.Hobbiton    (Attached)
[detached]

Synopsis:

Assuming more than one screen running (detached or not).

-list:	List screens running

-r:	If only one screen is detached, it gets attached, otherwise as in
	-list

-R:	If only one screen is detached, it gets attached.  If more than
	one is attached, as in -list.  If all screens attached, new screen
	spawend.

-RR:	The first available detached screen is attached, otherwise a new
	one is spawned.

-dr:	same as -list (remember, more than one screen running)

-dR:	same as -list

-dRR:	The first available screen is detached and attached here, even if
	there's a detached screen around too. 

So, -R equates to -r but will spawn a new screen if none available.

Conor
-- 
Conor Daly <conor.daly at oceanfree.net>

Domestic Sysadmin :-)
---------------------
Hobbiton.cod.ie
 13:20:04  up 37 days, 21:36,  5 users,  load average: 0.12, 0.08, 0.03



More information about the ILUG mailing list