jos*_*chi 22
试试monit。
您可以使用这样的配置来完成您的任务:
check process gameserver with pidfile /var/run/gameserver.pid
start program = "/etc/init.d/gameserver start" with timeout 60 seconds
stop program = "/etc/init.d/gameserver stop"
if cpu > 80% for 2 cycles then alert
if cpu > 95% for 5 cycles then restart
if totalmem > 200.0 MB for 5 cycles then restart
if loadavg(5min) greater than 10 for 8 cycles then stop
if failed port 12345 type tcp with timeout 15 seconds
then restart
if 3 restarts within 5 cycles then timeout
Run Code Online (Sandbox Code Playgroud)
有关此配置的详细信息可以在 monit 的文档中找到。