Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to trigger my python script remotely, but don't really want to expose any Web or other interface, eg. I need some passive way. One of the ways I can think of is by sending e-mail, then server can receive it and run the script. It is highly desirable to have an open console window on Ubuntu and then run the script, so I can see the output and progress if it lasts long and I will have direct access to it. But if not possible, then only running script would be enough, I'll think how to redirect output into file.

share|improve this question

procmail is one way to automatically run a script when e-mail gets received. Another way is to define a new mail alias, say, and make that just run a script. For example, in Postfix you would put to aliases something like  "|screen python"

Then just add necessary safe belts to your Python script so it won't automatically execute the software every time a new mail arrives to that box; make the script examine the mail body for keywords, or do something else.

Screen, what's that? Good old screen is here to help you for your monitoring needs. Just run your script with

screen python

Then you can login to your server and attach to that screen with

screen -rd

and when you are done watching progress, press Ctrl+a-d to detach the screen and leave it running.

share|improve this answer
but I don't have remote access to Ubuntu box when first running it. First task is to run it via e-mail. Second task is to somehow run it on console window. – Michael Aug 2 '11 at 9:10
Edited my reply a bit. Just run the screen from procmail or Postfix aliases? – Janne Pikkarainen Aug 2 '11 at 9:12

procmail is the usual way of approaching this. Set it up for a specific user, write the relevant procmail recipe and then mail to that user can trigger anything you like.

Some people will suggest alternatives to procmail since it hasn't been in active development for quite some time - however, it also works very well.

share|improve this answer

Your Answer


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.