Re: Fork, exec - setsid?
From: Anno Siegel (anno4000_at_lublin.zrz.tu-berlin.de)
Date: 11/23/04
- Next message: Robert Manea: "Re: Fork, exec - setsid?"
- Previous message: Sherm Pendley: "Re: redirect question"
- In reply to: Robert Manea: "Fork, exec - setsid?"
- Next in thread: Robert Manea: "Re: Fork, exec - setsid?"
- Reply: Robert Manea: "Re: Fork, exec - setsid?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 23 Nov 2004 15:02:28 GMT
Robert Manea <rob@nova.hbx.us> wrote in comp.lang.perl.misc:
> Hello everyone,
>
> I'm trying to solve a quite simply looking job but can't really come up
> with an elegant working solution.
>
>
> The why:
> --------
>
> I wrote a frontend to a DVB (digital video broadcasting) card in
> Gtk2 using Perl. So I came up with the need to fork some processes away
> and execute a couple of external programs via 'exec()'; these programs
> are linked together via pipes.
>
> The DVB-card is built in a remote machine so I first have to fork away a
> new process and do:
>
> exec('ssh remote-machine start-the-dvb-stuff-and-multicast-it')
>
> after that fork away another process and:
>
> exec('grab-the-stream | demultiplex-it | videoplayer').
>
>
> The problem:
> ------------
>
> As exec normally never returns and spwans a shell when it finds any
> metachars in the command to be executed there is no means to get the PID
> of those or the spawned shell.
The shell will have the pid that fork() returned to the parent.
> But unfortunatelly I have to quit those processes every time the user
> wants to switch channels via the parent.
>
>
> The question:
> -------------
>
> How do I kill the forked away programms without knowing their PID?
> Or better, how to kill them based on their SID?
Kill the shell that runs the pipeline. You have the pid.
Anno
- Next message: Robert Manea: "Re: Fork, exec - setsid?"
- Previous message: Sherm Pendley: "Re: redirect question"
- In reply to: Robert Manea: "Fork, exec - setsid?"
- Next in thread: Robert Manea: "Re: Fork, exec - setsid?"
- Reply: Robert Manea: "Re: Fork, exec - setsid?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|