[Idle-dev] Serious problems getting idlefork to display on multiple xservers
Michael Williams
michael.williams@st-annes.oxford.ac.uk
Fri, 10 May 2002 16:13:51 +0100
On Fri, May 10, 2002 at 09:05:14AM +0200, Hernan Martinez Foffani wrote:
> Your solution will work provided you don't have any service listening
> above the port 4096. You can't restrain the OS the range of PIDs it
> generates. Besides many processes that use sockets don't register
> themself in /etc/services. As Guido said, the netstat may also help
> you.
Yes. We had a good look at ports in use before deciding on that
solution. With the way Solaris uses ports (i.e. almost at random!)
we may still get problems but it does appear to work.
> An alternative that may interest you which does not differ too much
> what you did, is to add the user id of each student to 4096 instead.
>
> This has the problem that a user can't have more that one idle running
> at the same time.
We did consider getuid, but rejected it for precisely that reason. It
seemed that although having more than one instance running *might* be
confusing, a user who types idlefork a second time most probably wants a
second instance, so that's what they'll get.
For anyone who's interested, we wrote the script in Python. It was our
sysadmin's first look at it and he seemed to like it. We'd spent several
minutes looking through man pages for the syntax in sh or csh until I
said let's just use python.os. Here's what we came up with--hardly
rocket science but it works:
import os
thispid = os.getpid()
portnumber = thispid + 4096
os.putenv("IDLEPORT", str(portnumber))
os.system("/usr/local/bin/idle-0.8.1")
--
Michael