[LUNI] Kill previous command?
Samir Faci
sfaci at cs.uic.edu
Wed Jun 20 12:22:55 CDT 2007
well, if you have a unique name you can use something like this
pgrep "myuniquescript" | xargs kill -9
that'll work, but the script name has to be unique.
--
Samir
On 6/20/07, Mike Scott <mscott at pyewacket.org> wrote:
> I have seen a combination of piping the ps command through grep using
> the command name to locate the PID and feeding that to kill. 'cat' may
> be a bit ambiguous so you might want to launch one script to start the
> process then fire off another to nuke it.
>
> Also, if you fire off the cat command in the background (append an
> ampersand to the end) with backticks around it, it should return the
> PID, which you can save in an environment variable and use that later
> to kill it.
>
> - Mike Scott
>
>
> > -------- Original Message --------
> > Subject: [LUNI] Kill previous command?
> > From: "Michael Labowicz" <mlabowicz at gmail.com>
> > Date: Wed, June 20, 2007 10:30 am
> > To: "Linux Users Of Northern Illinois - Technical Discussion"
> > <luni at luni.org>
> >
> > Dear Luni,
> > I'm looking to record some FM radio off of my ivtv-compatible hardware
> > encoding card. I'm currently planning on calling a script like this
> > through
> > a cron job and ending it through the use of a combination of sleep and
> > kill:
> >
> > #! /bin/sh
> > cat /dev/video24 > recording.wav & sleep 3h
> > kill (previous process?)
> >
> > Problem is, I'm not sure how to kill the previous command, I know it has
> > something to do with the ! symbol, but I can't seem to find how to do it.
> > Any ideas?
> >
> > Thanks in advance!
> >
> > --
> > Michael Labowicz
> > http://www.labowicz.com/blog/
> > --
> > Linux Users Of Northern Illinois - Technical Discussion
> > http://luni.org/mailman/listinfo/luni
>
> --
> Linux Users Of Northern Illinois - Technical Discussion
> http://luni.org/mailman/listinfo/luni
>
More information about the luni
mailing list