On 2/6/08, Jörn Nettingsmeier <[EMAIL PROTECTED]> wrote: > Andreas Hartmann wrote: > > I don't know if this behaviour is intended: > > When I start my Lenya 1.2.x, the process ID seems to be written to a > > file. Ctrl+C doesn't shutdown Jetty, but the next ./lenya.sh kills the > > process with the stored ID. > > > > Is there any special reason for this behaviour? IMO storing PIDs is > > dangerous - on the next day, the ID could be assigned to another process > > which will be killed when you startup Lenya ... Or is this not possible? > only if you own it. if you run lenya as a special user (which you really > really should), then there's no danger at all. if you run lenya as root, > you get what you deserve :) > > storing PIDs is standard behaviour for daemons that are singletons. > check the /var/run directory of most unix systems for an overview of how > many programs do it... > Jörn Nettingsmeier
I stored the PID to add the "stop" option. As Jorn states, this is standard *nix behavior. The PID being stored is returned from the java command, not the process calling lenya.sh. The PID is not stored when starting in "cli" mode to prevent interfering with a known user process. To allow hijacking through reuse of the PID, a user would need to kill the process without using lenya.sh and find a method to start a new process on that PID. I thought the OS always assigns the PID and has enough PID numbers that I have never seen a rollover. Can an OS assign a new Java/Jetty/Lenya process a PID that is already in use? The stop command is programmed so any call to lenya.sh stops the running server before starting a new server (or just killing the old server with the "stop" option.) Without that, a new server would start, the old server would be orphaned, the new server is inaccessible because the port was already used by the first server, and many processes would continue running without purpose. Remember this was added with code that locks lenya.sh to its directory. Multiple instances of Lenya (on different ports) can run from different directories. The stored PID only affects the server from the directory containing that copy of lenya.sh (which is why the PID is stored in that directory rather than the typical global location. Differentiating between multiple instances of Lenya storing PIDs in one global directory would have been more complicated.) solprovider --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
