I'm running web2py in conjunction with a suite of other, independent, 
python processes.  In development I often want to 'ps' or kill the entire 
suite from the command line.  I've found the Python setproctitle module 
really useful for prepending a common label to all the process titles.

In each process's __main__ code, I use something like the following:

from setproctitle import setproctitle, getproctitle
_proclabel = "thisapp" 
if not getproctitle().startswith(_proclabel): 
    setproctitle(_proclabel + '  ' + getproctitle())



This puts the label at the front, so I can do things like 


ps ax | grep 'thisapp' 

17162 s000  S      0:00.15 thisapp processes  

17163 s000  S      0:00.02 thisapp simulation_service  

17164 s000  S      0:00.06 thisapp statehouse_service  

17167 s000  S      0:00.08 thisapp serial_interface_service  

17168 s000  S      0:00.01 thisapp email_service  

17169 s000  S      0:00.05 thisapp periodic_serial_query_service  

I want to also label the web2py process at startup.  So far, the only way 
I've found is to include the setproctitle code in an app's  0.py model file 
and then have my startup script fetch the index page after web2py is up and 
running.  


It would be nicer to be able to put it in script that runs once as 
web2py.py starts, but there doesn't seem to be a way to do that without the 
-R option which is recommended on for -S shell invocations of web2py.  


I'd rather not hack web2py.py or one of the gluon modules.  Is there a 
better way?


Thanks!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to