ruby脚本监控puma内存重启策略
作者:
ifree321 | 来源:发表于
2019-07-01 12:19 被阅读0次puts "== start checking..."
main_process_command = "ps aux --sort rss |grep tcp://0.0.0.0:8888"
main_process_result = `#{main_process_command}`
main_process_lines = main_process_result.split("\n")
main_process_pid = main_process_lines.last.split(' ')[1]
command = "ps aux --sort rss | grep #{main_process_pid}"
result = `#{command}`
lines = result.split("\n")
last_line = lines.last
splited_puma_last_line = last_line.split(' ')
puts last_line
if splited_puma_last_line[5].to_i > 1350000
puts "== located too many memory , phased-restart..."
`#{"cd /opt/app/www.wondercv.com/current && ./restart_very_quickly"}`
else
puts "-- ok"
end
本文标题:ruby脚本监控puma内存重启策略
本文链接:https://www.haomeiwen.com/subject/rxkgcctx.html
网友评论