6

I'm trying to piece together some Python code to control UNIX screen processes (/usr/bin/screen) as part of a script to ease on-server deployment. Are there any libraries or modules that could facilitate this? Is there a better way to do this than just using a standard Python subprocess?

9
  • I'm not sure what you're exactly looking for, but you might want to take a look at byobu source code as an example about how to enhance screen. Commented Nov 29, 2011 at 17:48
  • I was wondering if there was some nice API -- ideally in Python -- out there to control /usr/bin/screen instead of wrapping command line commands in subprocesses. Commented Nov 29, 2011 at 17:56
  • 1
    This honestly sounds like a job more suited to bash. Does it need to be python? Commented Nov 29, 2011 at 20:57
  • If I may ask, what exactly in your server deployment process requires screen? Commented Nov 30, 2011 at 0:50
  • We run most of our processes through screen rather than as daemons, since this makes it in many ways easier to check the status of our deployed processes and to interact with their CLI. Commented Dec 3, 2011 at 15:30

3 Answers 3

5

Found the solution. There's a Python module called screenutils.

Sign up to request clarification or add additional context in comments.

Comments

3
+25

You could use pexpect.

There is also a fork: pexpect-u

I'm not 100% certain there isn't any limitations in pexpect compared to expect, but if you find any you can always try your hand at some tcl :)

Comments

3

Do you need to use screen? Because what you need sounds just like what "fabric" (made in Python) was designed for: controlling multiple remote servers from Python scripts or interactive shell.

Here is a ink to fabric overview: http://docs.fabfile.org/en/1.3.3/index.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.