Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Sep 2008 00:27:22 -0700
From:      "Richard Yang" <kusanagiyang@gmail.com>
To:        Agus <agus.262@gmail.com>
Cc:        questions@freebsd.org
Subject:   Re: problem killing a process with its pid
Message-ID:  <abd417bf0809140027s2d0c9e75s263def5b66350f79@mail.gmail.com>
In-Reply-To: <fda61bb50809140000n48ef4c35hedaadcca67d05cc4@mail.gmail.com>
References:  <abd417bf0809132333g13670fey7e0cfc016157c029@mail.gmail.com> <fda61bb50809140000n48ef4c35hedaadcca67d05cc4@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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@gmail.com>

> 2008/9/14 Richard Yang <kusanagiyang@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@richardyang.net
> > kusanagiyang@gmail.com
> > _______________________________________________
> > freebsd-questions@freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe@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@richardyang.net
kusanagiyang@gmail.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?abd417bf0809140027s2d0c9e75s263def5b66350f79>