the daemon that won't die

Colin Brace cb at lim.nl
Sun Mar 2 13:55:30 UTC 2008


Hi all,

I made the mistake of trying to run greyscanner
<http://www.ualberta.ca/~beck/nycbug06/scripts/greyscanner> as a
regular user. Now, everytime it runs (every 30 minutes), there is a
cron error from user "operator" complaining that "you need to be root"
to run /usr/libexec/save-entropy. Moreover, each time this happens, an
instance of greyscanner, belonging to user operator, remains dormant
in memory, which means an additional instance of perl. After a day or
so most of my swap memory is used. up.

I have tried killing every PID associated with user operator and/or
greyscanner, but like Lazarus the thing keeps rising from the dead
every 30 mins. I can't figure out what process is keeping it alive.

FWIW, here is the relevant snippet from the script:

# daemonize and scan in a loop.

&daemonize;
while (1) {
    setlogsock('unix');
    openlog("greytrapper", 'pid', 'mail') || die "can't openlog";
    syslog('debug', "Scan started");
    my $pid;
    $pid = fork();
    if (!$pid) {
        # child. scan away...
        &scan;
        exit(0);
    }
    # parent waits and sleeps.
    wait;
    syslog('debug', "Scan completed");
    sleep($SCAN_INTERVAL);
}

I am not a perl programmer, and it is not immediately obvious what is
going on here.

So, how to I kill this bugger once and for all?

Thanks.

$ uname -r
7.0-PRERELEASE

-- 
  Colin Brace
  Amsterdam
  http://lim.nl


More information about the freebsd-questions mailing list