Jonny Flowers
Jonny Flowers

Reputation: 631

Checking if cherrypy is active

I have a process that starts up cherrypy runs a task and then needs to check if it is still running or has completed it's task. I am running python 2.6.7

 while True:
      if t1.isAlive():
           cherrypy.engine.start()
      else:
           cherrypy.engine.stop()
           print "server down"

Upvotes: 2

Views: 1126

Answers (1)

Don Question
Don Question

Reputation: 11614

There are several ways to do it. It depends what you really want. Do you want to check if a process is still alive and kicking, or do you need some feed-back information?

Or do you just have to check for an output (file/log/db)? Give us some more information. Some code-examples would clarify your problem

I guess you could take a look at the PIDFile plugin. With this plugin you could even do a Multiprocess or a check independent of which process started a cherrypy-instance.

Just after the start you initialize the pidfile-plugin and check anywhere outside if the file exists. Only caveat, it may block on zombie-processes or if the pidfile doesn't get erased.

Upvotes: 2

Related Questions