title: how to kill specific process using %cpu over given time in python on linux?
body: <p>I have this script in python on linux which deploys vnc locally, does some graphical job on this vnc screen, and kills vnc. Sometimes after the job is done process named gnome-panel hangs and stays with 100% cpu usage. Then I need to log in through putty and kill all those processes manually (sometime lots of them actually). I would like to add few lines to my python script when it finishes its job, which will not only kill vnc (it does it already), but also kill gnome-panel if it consumes certain amount of cpu over given time period. I cant simply kill all gnome-panels, as some of them are working fine (im deploying 4 vnc screens at the same time).</p>
  
  <p>So I need this condition in python:</p>
  
  <p><strong>if process name is gnome-panel and consumes over 80% of cpu and runs over 1 minute, kill process id</strong></p>
  
  <p>thank you!</p>