title: Don't kill created processes, which created by ps - linux
body: <p>give some advice, please.</p>
  
  <p>I am trying to kill processes remotely (ssh to hostname), find some processes and kill them. But I have a condition: <code>Do not kill java process, sshd and gnome</code>.</p>
  
  <p>Here is example (I just do <code>echo</code> except <code>kill</code>):</p>
  
  <pre><code>#/bin/sh -x.
  HOSTFILE=$1
  vars=`cat $HOSTFILE`
  for i in $vars; do
   ssh  "$i" /bin/bash &lt;&lt;'EOF'
    echo $(hostname)
    ps aux | grep -e '^sys_ctl'| grep -v "java" | grep -v "sshd" | \
    grep -v "gnome" | awk '{print $2$11}'|  for i in `xargs echo`; do  echo $i; done;
  EOF
  done
  </code></pre>
  
  <p>The result is:</p>
  
  <pre><code>host1:
  21707/bin/bash
  21717ps
  21718grep
  21722awk
  21723/bin/bash
  21724xargs
  host2:
  15241/bin/bash
  15251ps
  15252grep
  15256awk
  15257/bin/bash
  15258xargs
  89740-bash
  98467sleep
  98469sleep
  98471sleep
  98472sleep
  98474sleep
  98475sleep
  </code></pre>
  
  <p>I want to kill (<code>output</code>), <strong>only</strong> <code>sleep</code> processes, <strong>not</strong> <code>grep,awk,bash,xargs,ps</code>
  Can you suggest something elegant?</p>