Re: [Webware-discuss] webkit and PIDs
Oliver Bock wrote: Unfortunately OS X does not include /proc and therefore FreeBSD probably doesn't either. My impression is that /proc is a relatively recent innovation. I did not know this about OS X. Actually, the procfs is not something new. FreeBSD has it, too (maybe a bit different there). Anyway, we probably have to resort to locking at least for the generic start script (Webware comes with a bunch of different start scripts in the folder WebKit/Startscripts). But locking is also different on various platforms. We have to be careful to do it right. I found an article which may be helpful: http://www.unixreview.com/documents/s=1344/ur0402g/ I will try to come up with a solution based on that. -- Christoph ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] webkit and PIDs
On Wed, 14 Jun 2006 11:48:25 +1000, Oliver Bock [EMAIL PROTECTED] wrote: Unfortunately OS X does not include /proc and therefore FreeBSD probably doesn't either. My impression is that /proc is a relatively recent innovation. Hardly! It's as old as the X window system. /proc first appeared in SVR4 in 1984. Solaris had it in version 2.5. OpenBSD has it. I'd be shocked if FreeBSD didn't, and I'm very surprised that OS/X doesn't. -- Tim Roberts, [EMAIL PROTECTED] Providenza Boekelheide, Inc. ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] webkit and PIDs
FreeBSD only provides part of /proc when linux compat is enabled. On 6/15/06, Oliver Bock [EMAIL PROTECTED] wrote: Tim Roberts wrote: On Wed, 14 Jun 2006 11:48:25 +1000, Oliver Bock [EMAIL PROTECTED] wrote: Hardly! It's as old as the X window system. /proc first appeared in SVR4 in 1984. Solaris had it in version 2.5. OpenBSD has it. I'd be shocked if FreeBSD didn't, and I'm very surprised that OS/X doesn't. Plenty of weird stuff came out with SVR4. Sensible people (and their operating systems) shunned these innovations for the architectural purity of the original BSD mechanisms. Sadly Linux has ushered in the age of *nix populism, and now everybody wants everything. Oliver P.S. http://www.kernelthread.com/mac/apme/procfs/ explains a bit about why OS X doesn't have it. ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
Re: [Webware-discuss] webkit and PIDs
Oliver Bock wrote: I am having problems using the webkit script from my working directory to start AppServer when my machine starts. The trouble seems to be that webkit loads its old process ID in $PID_FILE, then finds that that particular PID already exists (there are lots of low-numbered processes during startup) and so decides not to run AppServer. Normally, this should not happen if the script is properly installed as a rc start and stop script. When the machine is shut down, webkit should be stopped properly and the PID_FILE deleted. But you're right, it may happen if Webware was not shut down properly and there is another process with the same PID running. So instead of simply testing whether a process exists, we could check the process command as well and require it to be something like python Launch.py ThreadedAppserver But this would still fail if you run several Webware instances. We need to check whether the process really belongs to the PID_FILE. Perhaps webkit should use fcntl.flock? Just so I understand properly: You suggest that the PID_FILE is created with a lock (you can also use os.open for that), and then the start script checks with fuser whether the process in the PID_FILE is the same as the one that has PID_FILE locked? That should work, but it would waste a file descriptor, and I'm not sure whether fuser is available everywhere. Maybe the following would be better. It does not need any locking. PID=`cat $PID_FILE` if [ tr \\000 \\040 /proc/$PID/cmdline | grep -q -i $PID_FILE ] then conclude that Webware is still running... What do you think? -- Christoph ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss
[Webware-discuss] webkit and PIDs
I am having problems using the webkit script from my working directory to start AppServer when my machine starts. The trouble seems to be that webkit loads its old process ID in $PID_FILE, then finds that that particular PID already exists (there are lots of low-numbered processes during startup) and so decides not to run AppServer. Am I missing something? Perhaps webkit should use fcntl.flock? Oliver ___ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss