problem killing a process with its pid

Richard Yang kusanagiyang at gmail.com
Sun Sep 14 07:27:23 UTC 2008


Thank you :)
actually,
kill -9 $(cat /var/run/natd.pid |cut -d" " -f1)
in a script
will work... (4 hours of work for this....)


for some reason, 'kill' doesn't think 'cat natd.pid' is a valid pid.
i have to specially cut the first part out to get it straight
i am using csh

i tried your suggestions just now and below are the result

kill -9 `cat /var/run/natd.pid`
kill: Arguments should be jobs or process id's

kill -9 `cat /var/run/natd.pid|cut -d" " -f1`
kill: Arguments should be jobs or process id's

what do you think is the reason?
i most certainly flunk my shell... hehe

rich


2008/9/14 Agus <agus.262 at gmail.com>

> 2008/9/14 Richard Yang <kusanagiyang at gmail.com>:
> > I have been trying to kill the process by pulling natd.pid
> > below are 3 typical examples among a couple dozens I tried
> >
> > kill -9 $(natd.pid)
> > Illegal variable name
> >
> > kill -9 '/var/run/natd.pid'
> > kill: Arguments should be jobs or process id's
> >
> > cat /var/run/natd.pid | kill -9
> > (no error returned, but natd process is still up)
> >
> >
> > could someone help?
> > thanks.
> >
> >
> > --
> >
> > Best Regards
> >
> > Richard Yang
> > richardyang at richardyang.net
> > kusanagiyang at gmail.com
> > _______________________________________________
> > freebsd-questions at freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe at freebsd.org"
> >
>
> Hi,
>
> I dont think this ways are correctly form...
>
> You probably want to kill the PID thats in that file, so the use as a
> variable, has no use...hehe
>
> kill -9 `cat /var/run/natd.pid`
>
> Notice the quotes aren simple..they are like an ascent towards the left....
>
> that will probably work
>
> If not you can also use the xargs command in the last one u put,
> before the kill -9...
>
> Cheers,
> Brahama
>



-- 

Best Regards

Richard Yang
richardyang at richardyang.net
kusanagiyang at gmail.com


More information about the freebsd-questions mailing list