Daniel, your locking mechanism is actually very bad, this will eventually break. Do not use non-atomic operations for locking!
A better approach for locking is actually something like flock
Daniel, your locking mechanism is actually very bad, this will eventually break.
Do not use non-atomic operations for locking!
A better approach for locking is actually something like flock