start script automatically

Ben Finney bignose-hates-spam at and-zip-does-too.com.au
Tue Jul 8 19:45:34 EDT 2003


On Tue, 08 Jul 2003 11:17:37 +0200, Tom wrote:
> I have a problem because I don't know how to start my script 
> automatically after a special event happens.

You have two options:

  - Have the process causing the event, also cause the script to run.
    It's in the best position to know when the script should be run,
    after all, since it created the event.

  - Have a separate process watching for the event, which can then run
    the script reactively.  This can either be a scheduled event, if the
    frequency is low (every few minutes or longer), or a
    continuously-running process (also known as a daemon on Unix).

Which you prefer is dependent on how much you consider the two stages to
be linked together.  If they are conceptually part of the same "event",
then the first option is preferable.  If the two steps are conceptually
separate, keeping the processes separate may be preferable since you are
not then committed to running them always in sequence.

-- 
 \                "Too many Indians spoil the golden egg."  -- Sir Joh |
  `\                                                   Bjelke-Petersen |
_o__)                                                                  |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B




More information about the Python-list mailing list