Results 1 to 7 of 7
Hi All,
Hope someone can help.
I am running memcached on a few servers, this runs OK.
What I would like to do is create a runtime script, so I ...
- 06-11-2007 #1
Find and kill process
Hi All,
Hope someone can help.
I am running memcached on a few servers, this runs OK.
What I would like to do is create a runtime script, so I can stop, start & restart the process any time if required and also so that it starts at boot time.
Starting the process in a script is straight forward, but stopping it is a bit different since the process ID changes each time.
So far I have been using a separate script to kill the process:
#!/bin/bash
if [$1 -eq ""]; then
echo "Usage : ./pkill.sh <process name>"
else
get_proc=`ps -e -o pid,command | grep $1`
echo $get_proc > get_it
get_pid=`gawk -F" " '{ print $1 }' get_it`
kill $get_pid
fi
but this requires me to run a script from within a script, I'm sure there is a better way...
Regards
Paul.
- 06-11-2007 #2
If the name stays the same you can try something like:
Code:kill -15 $(pidof [name_of_process])
- 06-11-2007 #3
- 06-11-2007 #4
Hi,
I just get the usage message back
kill: usage: kill [-s sigspec | -n signum | -sigspec] [pid | job]... or kill -l [sigspec]
Any ideas?
- 06-11-2007 #5
Try:
pkill name_pattern_here
See the manpages for pgrep(1) for more details on using pkill.
- 06-11-2007 #6Linux User
- Join Date
- Feb 2006
- Posts
- 484
or maybe chose the easy way

killall -9 <process_name>
- 06-12-2007 #7


Reply With Quote
