Petteri Räty <[email protected]> wrote: > On 27.11.2012 2.35, Eric Wong wrote: > > >> > >> nginx does not explicitly unlink the old pid file before it renames it > >> out of the way so yes matching nginx in that regard changes the behavior > >> exactly how I originally asked but you were against that. Maybe the > >> point is moot though. > > > > Ah, I thought you wanted the pid file to be replaced without > > a window where the file is non-existent (or empty). > > > > That would be ideal but I meant this thread to be explicitly about the > unlink and resulting couple seconds window. Now that I have spend some > thinking about the issue here's an approach using hard links that can be > used to replace the pid without window of non-existance:
Yes, this is ideal, but unfortunately, the window of non-existence is necessary for compatibility with some existing (nginx-based) scripts. PID files are horrible :< > betelgeuse@mac ~/inotify/test_files $ echo "old" > a > betelgeuse@mac ~/inotify/test_files $ ln a a.oldbin > betelgeuse@mac ~/inotify/test_files $ for file in *; do echo $file: > $(stat -f %i $file); done > a: 3730129 > a.oldbin: 3730129 > betelgeuse@mac ~/inotify/test_files $ echo "new" > b > betelgeuse@mac ~/inotify/test_files $ mv b a > betelgeuse@mac ~/inotify/test_files $ for file in *; do echo $file: > $(stat -f %i $file); done > a: 3730137 > a.oldbin: 3730129 > betelgeuse@mac ~/inotify/test_files $ cat * > new > old _______________________________________________ Unicorn mailing list - [email protected] http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying
