in reply to Re: flock on Ubuntu 9.10
in thread SOLVED [flock on Ubuntu 9.10]

What can I say you and ikegami hit the nail right on the head. Adding non-blocking flag did the trick. The only thing I would like to add, so not really related to my original post, is that if Proc::Daemon::Init is used to daemonize the process, flock call has to be after Proc::Daemon::Init call, otherwise Proc::Daemon::Init releases the lock as it forks the app. Thank you!

Replies are listed 'Best First'.
Re^3: flock on Ubuntu 9.10
by ikegami (Patriarch) on Nov 14, 2009 at 07:14 UTC
    Part of daemonizing involves forking and exiting the current process. Proc::Deamon uses exit to exit the current process. This closes open file handles, releasing associated locks.