[OT] remove process or file [was Re: [plug] funny process name]
Ben New
ben at leftclick.com.au
Tue Sep 30 15:19:56 WST 2003
Bernd Felsche wrote:
>On Tue, Sep 30, 2003 at 02:03:48PM +0800, Ben New wrote:
>
>
>>Bernd Felsche wrote:
>>
>>
>>
>>>I'm still waiting for
>>> rm proc/somenumber
>>>to remove a process.
>>>
>>>
>>>
>>>
>># mv /bin/rm /bin/rm.orig
>># vi /bin/rm
>>for p in ${@#/proc/} ; do
>>if [ -e /proc/$p ] ; then kill -KILL $p ; fi
>>done
>>/bin/rm.orig $@
>>:w
>>:q
>># chmod +x /bin/rm
>>
>>
>
>Cheeses! I was looking for something in the filesystem.
>
>
hehe... you mean you don't like my hack? awww ;-)
>
>
>>Not bulletproof! (I just whipped it up then) but it will work for "rm
>>1234" or "rm /proc/1234"
>>;-)
>>
>>I'm sure there's a better way to test for a process with given ID ($p)
>>other than testing for a file in /proc, but not sure how?
>>
>>
>
>kill -0 $p && kill -KILL $p
>
>
guess that would make sense ;-) the -0 option sends signal 0 (which does
nothing) to the process, so effectively just tests for the pid.. right?
Ben
--
Ben New
ben at leftclick.com.au
Leftclick Software Development
http://www.leftclick.com.au/
_______________________________________________
plug mailing list
plug at plug.linux.org.au
http://mail.plug.linux.org.au/cgi-bin/mailman/listinfo/plug
More information about the plug
mailing list