in reply to Re^2: how many instances are running ?
in thread how many instances are running ?

jeanluca,

davorg has the right solution. You can have lots of instances of a program that reads a file or filehandle, but they will fail to read as soon as one instance starts up to lock and write that same filehandle. You need to accomodate that fail-to-read condition as well as fail-to-lock. It's really simple. Stevens is a good reference, everybody should (and most sysprogs do) own this.

Reading the /proc filesystem (through ps) to read PIDs & arguments is the way to do what you're trying to do, at least on Linux. You can then parse the response. It's not the way to solve your original problem, though.

Your use of '-w' for your write flag has bart scratching his head. He thinks you're referring to Perl's -w warnings-on switch. /me injects coffee into bart. :)

HTH. :D

Don Wilde
"There's more than one level to any answer."