A monitor helps you kill process when cpu usage is too high.
cpucare is a monitor tool that autmatically sends signal(usually SIGTERM) to process where cpu usage is too high.
var cpucare = require'cpucaure';var target_process = 0; // should be your target processvar c =target: target_processmark: 90 // sends signal only when cpu usage is higher than 90cycle: 30*1000 // checks per 30 secsignal: 'SIGTERM' // defaults to SIGTERM;// you should get and only get one processkilled event when target process is killedconce'processkilled'console.log'target_process is killed' info;;
What you may get:
target_process pid: 11394master pid: 11392target_process is killed cpu: 93.2memory: 14553088mark: 90signal: 'SIGTERM'cycle: 30000pid: 11394