Killing process with a shell script

From: Andreas Hoeschler (ahoesch@smartsoft.de)
Date: Tue Jan 13 2004 - 10:55:00 EST


Dear managers,

I am desparately trying to figure out how to kill a process (the
complete path is given) with a shell script.

#!/bin/sh
a=`/usr/bin/ps -ef | /usr/bin/grep pop-before-smtp | grep -v grep`;
if test "$a" = "" ; then
         echo "Does not run!";
else
         echo "Trying to kill, but how?"
fi

I can determine whether the process runs. The above gives me

     root 27721 1 0 Dec 06 ? 0:00
/usr/local/bin/pop-before-smtp

in the variable a. But how can I isolate the pid of the process so that
I have something to pass to kill?

Thanks a lot!

Regards,

    Andreas
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:27:49 EDT