18794: Make "touch restart.txt" recipe work when owned by root.
[arvados.git] / services / api / config / initializers / reload_config.rb
index 65f02e07a4e8bf942657358c1fd9538c7b7813af..1582855bfb29203a511546a3b7ec505dfee4658f 100644 (file)
@@ -50,6 +50,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