The "standard" locking snippet I've seen goes something like...
(
flock -n 200 || exit 1;
# do stuff
) 200>program.lock
Is it safe (testing seems to say so) to use exec at that point? Will the subprocess retain the lock?
(
flock -n 200 || exit 1;
exec /usr/bin/python vendors-notcoolstuff.py
) 200>program.lock
I vaguely remember exec'd processes retain open file descriptors and since flock uses file descriptors it should work. But I cannot find any documentation that makes that definitive and clear.
For the record, this is specific to Linux.