When deploying Rails via Passenger or Mongrel you have multiple instances of the application running. What is the best practice or pattern to establish a mutex on shared res
As far as I know, the only way to do this in an environment like this is to use a file-based semaphore - touch a lockfile, do your work, remove the lockfile. Make the process fail if there's a lock on the file.
You could also have a service that writes to the file that is threaded, and make the apps talk to the service to modify the file rather than letting them modify the file directly.