If root has done "touch {tmp}/restart.txt", then the www-data user
cannot utime() or write() the existing file, but can remove it and
create a new one.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>
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
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