3

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?

  • 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
1

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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