in reply to How can i check my script is already running?

Can anybody tell me where i am wrong?

First you tell us why you think something's wrong. In what way does it not do what you expect?

Second, your approach is very fragile, there are several ways to call your script that will break it (for example by using relative paths, or symlinks to the script).

Consider locking a particular file instead; you should find some examples here on perlmonks with Super Search.

Perl 6 - links to (nearly) everything that is Perl 6.
  • Comment on Re: How can i check my script is already running?

Replies are listed 'Best First'.
Re^2: How can i check my script is already running?
by JavaFan (Canon) on May 11, 2010 at 10:05 UTC
    And in particular, locking the file of the program itself. For instance, by locking the *DATA file handle.