Jason Hildebrand wrote:
> On Wed, 2004-12-01 at 12:11 -0600, Ian Bicking wrote:
>>I just noticed some checkins by Jason for PID files and whatnot.
>>Anyway, I have a different version of Launch.py that handles some
>>similar issues -- writes its PID out to a file, changes its user and
>>group, opens the log file. It also checks if there's another Webware
>>appserver (using the same pid file) and kills it if necessary (i.e.,
>>does a restart). This removes most of the logic from the rc/init
>>script, and away from stupid shell scripting, which I can never get to
>>work like I think it should.
> Hi Ian,
> I like the user/group/password stuff; that would be useful to have.
> We also probably decide which way to go on the PID stuff. In your source
> tree, have you removed the code from the appserver which creates the PID
> file (appserverpid.txt)? Or do you simply create an additional pid file
> with your launch script?
The only file I changed was Launch.py, so I guess appserverpid.txt was
just laying around ignored. The webkit rc script creates its own PID
file, but problematically, and that's what I was replacing. The webkit
script would also be replaced, just with a simpler version.
The other advantage of this was that the init script could call
AppServer instead of Launch.py directly, so reloading should work.
Though I feel like I've had troubles with it anyway.
>>I don't really like using Launch for all this, since it gets written out
>>by MakeAppWorkDir. I still don't quite understand what Launch is for.
> I agree. We should keep as much logic as possible in the webware tree
> (not in the working dirs). We _do_ need a few bits of info from the
> working directory in order to bootstrap the AppServer:
> 1. python version to execute (i.e. python2.2 vs. /usr/bin/python vs.
> 2. path to webware installation
> 3. path to working dir (so that you don't have to be _in_ the working dir
> to start/stop the appserver)
We could also use the (workdir's) Launch.__file__ to figure out the
> #1 is handled by AppServer/AppServer.bat. #2 and #3 are handled by
> Launch.py. I think that all further logic and command-line parsing
> (i.e. switching user/group, prompting for passwords, pid files, etc.) should
> be done by code in the webware tree (not in Launch.py, but perhaps in
> WebKit/Launch.py). Thoughts?
I forgot there was a second Launch in WebKit/Launch.py -- that would
probably be the right place for this to go. There's also the issue of
Windows. I guess they'll just get exceptions if they specify some of
these options, especially --user and --group. I don't think os.kill
will work on Windows either, will it? If os.kill isn't available, I'm
not sure if the startup script should bail (until the admin stops the
other appserver, or deletes the stale pid), or if it should keep trying
to start up.
Ian Bicking / ianb@... / http://blog.ianbicking.org