bash - Restart a process when cpu gets high -
i've got cron job checking webserver (seeing if active), handy..
http://pastebin.com/raw.php?i=kw8crfzh
i'm wanting after similar cpu usage. i'm running java backend gets 70%+ cpu. i'm after cron script automatically kill/restart java if cpu load gets high, how possible?
you use top
in batch mode coupled code parse output. example:
top -p 1234 -n 1 -b
will output snapshot of state of process 1234.
Comments
Post a Comment