更新时间:2023-11-01 09:56:40
好,我找到了解决方法...我将启动rails的方式更改为:
Ok I found a fix... I changed how I start rails to:
mongrel_rails start -d
,现在将执行以下操作:
and now the following action will do it:
def restart
fork { exec "mongrel_rails restart" }
redirect_to "/server_maintenance"
end
作为警告,redirect_to将导致失败的加载,因为服务器将关闭.但是暂停后重新加载将显示重新启动成功.可以通过更改重新启动以使用AJAX完成,然后重新加载javascript来解决此问题,但是我将其作为练习留给读者.
As a caveat, the redirect_to will cause a failed load because the server will be down... however a reload after a pause will show that the restart was successful. This could be fixed by changing the restart to be done with AJAX, followed by a javascript reload... but I will leave that as an exercise to the reader.