To do this we need to come up with a ps and grep combination that will only return one result. so grep as many times as neccessary and/or use keywords that are only found in your process name so you only get one result.
Remember to add [] somewhere in your first grep so grep doesn't matches itself.
output=$(ps -ef | grep m[y]ProcesseName )Then all you need to do is sending the QUIT signal to $2 which stores the PID of your process.
kill -QUIT $2So just add the above two lines to your script after modifying the first line to fit your needs and you should be good to go.
No comments:
Post a Comment