[mythtv-users] stagger start times for simultaneous recordings?

Mike Holden mythtv at mikeholden.org
Tue Dec 6 12:04:10 UTC 2011

Mark J. Small wrote:
> On October 23, 2011, Mike Holden wrote:
>> I suggest you have a look at "flock" (man flock has a good simple
>> overview). This provides a simple but foolproof locking mechanism
>> using a file locked in exclusive mode.
>> (
>>     flock -s 200
>>     # ... commands executed under lock ...
>> ) 200>/path/to/mylockfile
> Thanks, Mike, Ronald.
> Your posts helped me fix my change channel scripts.  Hopefully I'll
> have even
> fewer channel change problems.

Just to add that the locking mode mentioned in the man page is -s,
which is a share lock. You need to use -x for an exclusive lock,
otherwise you don't enforce any exclusivity at all!
Mike Holden

More information about the mythtv-users mailing list