On 27/04/11 22:33, Mike Orr wrote:

In Ubuntu, install the 'supervisor package' and create an
/etc/supervisor/conf.d/ file for your application. Here's an example:

[program:inews]
command = /home/wwwadmin/venv/inews2.5/bin/paster serve
/home/wwwadmin/apps/inews/production.ini
process_name = inews
autostart = true
startsecs = 5
;exitcodes = 0,2
user = www-data
redirect_stderr = true
stdout_logfile = /home/wwwadmin/data/inews/error.log

Note that the 'paster' is in a virtualenv, so it'll run under the
virutalenv environment. Also note that you don't daemonize the program
yourself: Supervisor does that.

Supervisor has three main advantages over traditional init.d scripts:
- It runs the application in a child process so it doesn't need a PID
file, and it knows immediately if the application dies..
- You can start/stop/list jobs with the "supervisorctl" command (which
I symlink to "supervisor").
- It's Python!

By "end user" do you mean yourself or another sysadmin? I don't
distribute daemon applications; I just run them myself. If you need to
distribute them so that an unknowledgeable sysadmin can install them,
it's more difficult. Every OS and Linux distro is different in its
daemon configuration. If your sysadmins are all running a DEB or
RPM-based system with a 'supervisor' and 'python-virtualenv' packages
available, you can make a DEB or RPM package for them containing the
application and Supervisor conf file and a postinstall script to
create a virtualenv. Otherwise I would just give them the application
tarball and a sample Supervisor conf file, with instructions on how to
build the virtualenv and configure Supervisor.


Thanks Mike.
Just one slightly off topic question but not a big one though.
If it is disturbing for the list then I would modestly request mike to reply off list. Can I use this same superwise tool for running a python twisted program as well?

Happy hacking.
Krishnakant.


--
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to