1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
puma--puma/lib/puma/plugin/tmp_restart.rb

24 lines
350 B
Ruby
Raw Normal View History

require 'puma/plugin'
Puma::Plugin.create do
def start(launcher)
path = File.join("tmp", "restart.txt")
File.write path, ""
orig = File.stat(path).mtime
in_background do
while true
sleep 2
if File.stat(path).mtime > orig
launcher.restart
break
end
end
end
end
end