Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have about 15 instances of screen running on my linux server. They are each running processes I need to monitor. I had to close terminal (hence the reason I launched screen).

Is there a way to reopen all 15 instances of Screen in different tabs without having to open a new tab, login to the server, print all the available screens to resume, and then type in the id for each screen session?

share|improve this question
    
What terminal are you using? Gnome Terminal, KDE, other? –  cjm Jul 12 '11 at 9:19
    
ANSWER (@cjm): I'm using terminal on mac osx. –  T. Brian Jones Jul 12 '11 at 9:21
add comment

1 Answer

up vote 0 down vote accepted

This python script just did the job for me. I made three screen sessions and this fires up three xterms with the sessions reattached in each. It's a bit ugly but it works.

#! /usr/bin/env python                                                                                                                         

import os

if __name__ == '__main__':

    tempfile = '//tmp//screenList'

    # capture allthescreenIds                                                                                                                
    os.system('screen -ls | grep Det | cut -d . -f 1 > ' + tempfile)

    f = open(tempfile, 'r')
    screenIds = f.readlines()
    f.close()

    screenIds = [x.lstrip() for x in screenIds]

    for eachId in screenIds:
        cmdLine = 'xterm -e screen -r ' + eachId.strip() + ' &'
        os.system(cmdLine)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.