File locking

Create a temp file for file locking
Where did this `warning` variable come from? perhaps you meant `logging`?