That was the question I asked myself when a running cron job on a shared hosting went horribly wrong. Turns out the solution is ‘pretty’ easy. You just have to know when the cron job started. In my case it was a PHP script. So i grep-ed for php also.
-
ps -ef | grep php
You get the list of processes matching your criteria. Then you have to look for the time the script should have started. In the second column there is it’s PID. You can use that to kill it.
-
kill $PID

This is really useful, thanks! What does the vertical line do, though? (the “|” before grep).
Glad it helped someone else.
That “|” is called “pipe”. It is best described on wiki – http://en.wikipedia.org/wiki/Pipeline_%28Unix%29