Using file descriptors seems like a bad idea to me, since they're just arbitrary numbers.

The flock manpage has a useful snippet for locking a shell script:

    [  "${FLOCKER}"  !=  "$0"  ] && exec env FLOCKER="$0" flock -en "$0" "$0"  "$@" || :