18794: Make "touch restart.txt" recipe work when owned by root.
[arvados.git] / apps / workbench / config / initializers / reload_config.rb
index 259f54732ca8211fade0db2d8a5b3a52b40198ee..58949c5e935950ed06c0c92dc1f1c10271f4e3b0 100644 (file)
@@ -54,6 +54,9 @@ else
           begin
             File.utime(touchtime, touchtime, restartfile)
           rescue
+            # remove + re-create works even if the existing file is
+            # owned by root, provided the tempdir is writable.
+            File.unlink(restartfile) rescue nil
             File.open(restartfile, 'w') {}
           end
           # Even if passenger doesn't notice that we hit restart.txt