|
If you are running it in the background, just store $! in a variable just after starting it, and kill $! when you need to.
top has options to tell how many iterations to run; perhaps you should be using those instead.
Don't use kill -9 unless you know what you are doing.
|