Skip to main content
added 53 characters in body
Source Link
slm
  • 379.7k
  • 127
  • 793
  • 897

You should be able to just kill the script by name using the pkill command.

$ pkill -9 dispatcher.sh

excerpt from man pageman page

pgrep, pkill - look up or signal processes based on name and other 
               attributes

OPTIONS
       -signal
       --signal signal
              Defines the signal to send to each matched process.  Either 
              the numeric or the symbolic signal name can be used.  (pkill 
              only.)

See the man page for pkillman page for pkill for more info.

Finding processes

If you find that you no longer know a process's process ID (PID) you can find it a couple of ways.

pgrep

You can use pgrep to find a process by name.

$ pgrep dispatcher.sh
12345

You can then perform a kill -8 12345.

ps

Most people learned to find PID's using ps. You can look for your process in the output like this.

$ ps -eaf | grep [d]ispatcher.sh
saml      2735     1  0 Jan11 ?        00:02:50 dispatcher.sh

The PID is the 2nd column in the output (typically). The above trick where I wrap the first letter of the process I'm looking for eliminates the grep from showing up in the results. Try it without the square brackets to see what I mean.

You should be able to just kill the script by name using the pkill command.

$ pkill -9 dispatcher.sh

excerpt from man page

pgrep, pkill - look up or signal processes based on name and other 
               attributes

OPTIONS
       -signal
       --signal signal
              Defines the signal to send to each matched process.  Either 
              the numeric or the symbolic signal name can be used.  (pkill 
              only.)

See the man page for pkill for more info.

Finding processes

If you find that you no longer know a process's process ID (PID) you can find it a couple of ways.

pgrep

You can use pgrep to find a process by name.

$ pgrep dispatcher.sh
12345

You can then perform a kill -8 12345.

ps

Most people learned to find PID's using ps. You can look for your process in the output like this.

$ ps -eaf | grep [d]ispatcher.sh
saml      2735     1  0 Jan11 ?        00:02:50 dispatcher.sh

The PID is the 2nd column in the output (typically). The above trick where I wrap the first letter of the process I'm looking for eliminates the grep from showing up in the results. Try it without the square brackets to see what I mean.

You should be able to just kill the script by name using the pkill command.

$ pkill -9 dispatcher.sh

excerpt from man page

pgrep, pkill - look up or signal processes based on name and other 
               attributes

OPTIONS
       -signal
       --signal signal
              Defines the signal to send to each matched process.  Either 
              the numeric or the symbolic signal name can be used.  (pkill 
              only.)

See the man page for pkill for more info.

Finding processes

If you find that you no longer know a process's process ID (PID) you can find it a couple of ways.

pgrep

You can use pgrep to find a process by name.

$ pgrep dispatcher.sh
12345

You can then perform a kill -8 12345.

ps

Most people learned to find PID's using ps. You can look for your process in the output like this.

$ ps -eaf | grep [d]ispatcher.sh
saml      2735     1  0 Jan11 ?        00:02:50 dispatcher.sh

The PID is the 2nd column in the output (typically). The above trick where I wrap the first letter of the process I'm looking for eliminates the grep from showing up in the results. Try it without the square brackets to see what I mean.

Source Link
slm
  • 379.7k
  • 127
  • 793
  • 897

You should be able to just kill the script by name using the pkill command.

$ pkill -9 dispatcher.sh

excerpt from man page

pgrep, pkill - look up or signal processes based on name and other 
               attributes

OPTIONS
       -signal
       --signal signal
              Defines the signal to send to each matched process.  Either 
              the numeric or the symbolic signal name can be used.  (pkill 
              only.)

See the man page for pkill for more info.

Finding processes

If you find that you no longer know a process's process ID (PID) you can find it a couple of ways.

pgrep

You can use pgrep to find a process by name.

$ pgrep dispatcher.sh
12345

You can then perform a kill -8 12345.

ps

Most people learned to find PID's using ps. You can look for your process in the output like this.

$ ps -eaf | grep [d]ispatcher.sh
saml      2735     1  0 Jan11 ?        00:02:50 dispatcher.sh

The PID is the 2nd column in the output (typically). The above trick where I wrap the first letter of the process I'm looking for eliminates the grep from showing up in the results. Try it without the square brackets to see what I mean.