in reply to Re^2: Windows process
in thread Windows process
# This is a trick used to prevent concurrent applications # from running, but that will work WITHOUT needing pid # or lock files, and so is kill -9 or power failure safe. # To work it needs a __DATA__ section to be defined at # the end of the file. use Fcntl 'LOCK_EX', 'LOCK_NB'; unless ( flock DATA, LOCK_EX | LOCK_NB ) { # An existing instance of this application is already running print STDERR "Program is already running\n"; exit(0); } __DATA__ Used as a lock to prevent concurrent execution. Do not remove this data section.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Windows process
by BrowserUk (Patriarch) on Sep 18, 2004 at 13:03 UTC |