UnixTips.net

* use my tips at your own risk !!

* use my tips at your own risk !!

Categories

  • Other (3)
  • Scripting (10)
  • Unix (70)
  • Wordpress (2)

Powered by Genesis

Kill Pid

#!/bin/ksh

## List all running processes and grep for the “program_name”
## make sure to ignore the grep process that is running (grep -v grep)
## The process id is the second column in the ps -ef statement

pid_var=`ps -ef | grep program_name | grep -v grep | awk ‘{print $2}’`

kill -9 $pid_var

## You might want to use “kill -9 $pid_var”