[OT] remove process or file [was Re: [plug] funny process name]

Bernd Felsche bernie at innovative.iinet.net.au
Tue Sep 30 14:23:54 WST 2003


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.

> 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

-- 
/"\ Bernd Felsche - Innovative Reckoning, Perth, Western Australia
\ /  ASCII ribbon campaign | I'm a .signature virus!
 X   against HTML mail     | Copy me into your ~/.signature
/ \  and postings          | to help me spread!
_______________________________________________
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