Quote:
Originally Posted by tronayne
You might look at PID, PPID, STIME and TIME in combination; have a look at what ps -ef shows you or ps -elf.
|
Yes, cool idea. I might use a combination of PID and starttime (e.g. see proc(5)). Thank you.
---
Quote:
Originally Posted by openSauce
Assuming the first one has come to an end, you already know the answer to your question without checking anything
|
No.
I start a process 'foo' in the background (using bash syntax).
> foo&
[1] 4321
It's easy to test whether a process with such a PID exists:
> kill -0 4321 && echo alive
alive
> kill -0 9999 && echo alive
bash: kill: 9999 - No such process
Now assume 'foo' terminates.
The PID counter wraps around.
Another 'foo' process is started, accidentally having the PID 4321 assigned.
> kill -0 4321 && echo alive
alive
Even looking in the process table will tell me that it's 'foo' running with PID 4321. But The original process died.
---
Any other suggestions?
Thanks,
Stefan