screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Python wrapper for gnu-screen


From: Christophe, Jean-Charles Narbonne
Subject: Re: Python wrapper for gnu-screen
Date: Fri, 24 Sep 2010 14:46:30 +0200

I use it to inject commands in servers console (I suppose CS and other game servers have this kind of behaviours)

It's a way to keep control and automate command insertion into instances...

still not really great for personnal customisation of screen as it inserts only in current window...

I'm affraid enable multi window support into screen will need me work against concurrency errors

Jostein, here a small example of current usage:
>>> from screenutils import list_screens, Screen
>>> list_screens() # wrap screen -ls  
[]
>>> s= Screen("session1",True) # create new screen session 
>>> # screen blink once
>>> s.send_commands('bash') # inject text en validate into session 
>>> s.enable_logs() 
>>> s.send_commands("df")
>>> print next(s.logs)
df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda6             20161172   8084052  11052980  43% /
none                   1505916       304   1505612   1% /dev
none                   1512676       936   1511740   1% /dev/shm
none                   1512676       380   1512296   1% /var/run
none                   1512676         0   1512676   0% /var/lock
none                   1512676         0   1512676   0% /lib/init/rw
none                  20161172   8084052  11052980  43% /var/lib/ureadahead/debugfs
/dev/sda7            403567768 196284216 186783420  52% /home
address@hidden:~/Dev/github/screenutils$
>>> s.disable_logs()
>>> s = None # loose the screen ref  
>>> s = Screen("session1") # connect back 
>>> s.exists
True
>>> s2 = Screen("session2")
>>> s2.exists
False
>>> s2.initialize() # initialize manualy the screen (as True in __init__) 
>>> list_screens()
[<Screen 'session2'>, <Screen 'session1'>]
>>>


On Fri, Sep 24, 2010 at 2:09 PM, Jostein Berntsen <address@hidden> wrote:
On 23.09.10,21:41, Sadrul Habib Chowdhury wrote:
> On Wed, Sep 22, 2010 at 3:37 AM, Christophe, Jean-Charles Narbonne <
> address@hidden> wrote:
>
> > Hi,
> >
> > I'm a french student and I used screen to administrate server since a long
> > time.
> >
> > I've never made personal config files or search deep in all screen features
> > but I developed for personal usage a lib in python for administration
> > scripts.
> > (it's allow to inject code into the screens sessions, use monitoring ...).
> >
> > I use it to automate things in shell flavored servers.
> >
> > As I published this lib, I now ask for feedbacks from interested advenced
> > screen scripters/users/developers... Is this kind of tool interesting? Which
> > feature should be added? Is the gnu-screen spirit respected?
> >
> >
> I think most people would agree that having greater control over screen from
> a script would be very useful. I would highly encourage people to help with
> adding native scripting support in screen. Some work has been already been
> done: http://git.savannah.gnu.org/cgit/screen.git/log/?h=scripting There's
> currently support for scripts written in python and lua. It would be
> extremely incredible if people would start using this, and fix bugs and/or
> request/implement new features etc. Once I settle down with my new job and
> the moving process, I plan to restart working on this myself (but working
> alone is really boring).
>

This sounda like a great functionality to have in Screen. Do you have
any examples of how it can be used?


Jostein



_______________________________________________
screen-users mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/screen-users



--
Best regards,
Christophe Narbonne

http://blogs.dotnet-france.com/christophen/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]