Use named semaphore for process synchronisation

File base locking is not safe from race conditions
Added compile of semaphore to rake task