if(open(READPID, "$ENV{SERVER_VAR}/proc/kestrel-server.pid"))
{
    chomp($pid = <READPID>);
    close READPID;
    print STDERR "Id to kill: $pid\n";
    $dirty = 0;  #whether to get system-dependent

    {
       local $SIG{QUIT} = 'IGNORE';
       kill 'ALRM', $pid or (print STDERR "$!: Couldn't signal kestrel-start to kill child group.\n" and $dirty=1);
    }
    if($dirty) {
	chomp(@procs = `ps aux -j`);
	foreach $line (@procs) {
	    if($line =~ /\s+(\d+)\s+$pid/) {
		kill 'KILL', $1;
	    }
	}
    }
    print STDERR "Removing kestrel-server.pid with entry $pid\n";
    unlink "$ENV{SERVER_VAR}/proc/kestrel-server.pid";
} else {
    print STDERR "No Kestrel server shown running in $ENV{SERVER_VAR}/proc/kestrel-server.pid\n";
}



