On 12/4/10 2:47 PM, Jim Burgess wrote:
> Hi,
>
> I have a FXRuby app, which is fine and dandy and does exactly what it
> should. However, if the user, for whatever reason, decides to start two
> instances of the app, bad things start happening.
> My question: is there any way for my app to check if another instance of
> itself is running before launching itself?

To make sure no more than 1 instance of the script is running:

gem install posixlock
require 'posixlock'
DATA.posixlock( File::LOCK_EX | File::LOCK_NB )

For full discussion:

http://tinyurl.com/2dsg5a9

Regards,

Dan