in reply to Killing wayward children

I'm with diotalevi on this one. kill INT, $pid will send the INT signal to the process with $PID, regardless of whether or not said process is a child of the process sending the signal. However, if the sending process is not running as root, the chances of actually interrupting another process with this are lessened because i) there needs to be a process with $PID, which with current 32-bit process ID spaces tends to take a while and ii) said process needs to be running under the same UID as the sending process. However, it is still not a chance one should take in production environments. Hence:

To check whether your $PID is still the correct process, have a look at Proc::ProcessTable to browse throught the process table. This will give you a way to check whether process $PID is still the correct one:

use strict; use Proc::ProcessTable; my $table=Proc::ProcessTable->new; my @procs=$table->table; foreach $p ($table->table) { if ($p->pid == $saved_pid) { send_signal() if ($p->cmdline eq "expected command line"); } } #Warning: code is utterly untested and not the most efficient either.

CU
Robartes-