[accessiblelinux] Re: sox, enterrupting playback with a script

  • From: Storm Dragon <stormdragon2976@xxxxxxxxx>
  • To: accessiblelinux@xxxxxxxxxxxxx
  • Date: Wed, 08 Aug 2012 03:23:47 -0400

Hi,
I wish I could get the pid, I have tried to do it, but for some reason
it doesn't work like I expect. I was hoping that because play -q
wouldn't have any text output other than the pid I could do:
#script {pid} {play -q file.ogg}
and have the pid stored in the tintin variable $pid. Unfortunately it
doesn't happen that way though. I wonder if a script could be written to
launch the play command and get the pid and return it, which would be
then passed to the tintin variable. All I'd have to do is echo it in the
script to get it saved in the tintin variable:
echo "$pid" but, how to get it to begin with lol.
Thanks
Storm
-- 
Vinux Publicity Coordinator: http://www.vinuxproject.org/
Registered Linux user number 508465: https://linuxcounter.net/user/508465.html
My blog, Thoughts of a Dragon: http://www.stormdragon.us/
My Blackberry is Broken: http://is.gd/my_blackberry_is_broken
"And for every crossing where two roads diverged. I fell one false decision. 
But still you find me on this earth."
Van Canto - I Stand Alone



On Wed, 2012-08-08 at 02:09 -0400, Kyle wrote:

> In order to kill only a certain instance of a process, you are probably 
> better off getting the pid of the process as it is spawned and then using 
> kill to signal it. Pkill only works to signal all processes called by a given 
> name. Kill operates on a given pid, and therefore may work better in your 
> situation.
> 
> You also may want to try a "quit" signal, I believe -15, rather than the 
> interrupt -2. This way, you may be able to avoid having to kill the process 
> twice. Someone please correct me if I got the signal number wrong for "quit," 
> which is the equivalent of pressing control backslash from within the program.
> ~Kyle

Other related posts: