config['php_path'])) { $php = $a->config['php_path']; } else { $php = "php"; } // Switch over to daemon mode. if ($pid = pcntl_fork()) return; // Parent fclose(STDIN); // Close all of the standard fclose(STDOUT); // file descriptors as we fclose(STDERR); // are running as a daemon. register_shutdown_function('shutdown'); if (posix_setsid() < 0) return; if ($pid = pcntl_fork()) return; // Parent $pid = getmypid(); file_put_contents($pidfile, $pid); // Now running as a daemon. while (true) { // Just to be sure that this script really runs endlessly set_time_limit(0); // Call the poller $cmdline = $php.' include/poller.php'; exec($cmdline); // Now sleep for 5 minutes sleep(300); } ?>