pcntl_signal(SIGTERM, "sig_handler"); pcntl_signal(SIGHUP, "sig_handler"); } else { #return control to the shell exit(0); } } #support pid file if (!empty($params['pid'])) { if (file_exists($params['pid'])) { $pid = trim(file_get_contents($params['pid'])); $ps = `ps -p{$pid}`; if (preg_match('/php/i', $ps)) { echo "Already running!\n"; exit(1000); } else { echo "Stale lockfile detected.\n"; } } file_put_contents($params['pid'], getmypid()); } if (empty($settings['flexcdc']['error_log'])) { $error_log = "flexcdc.err"; } else { $error_log = $settings['flexcdc']['error_log']; } global $cdc; $cdc = new FlexCDC($settings); #capture changes forever (-1): $cdc->capture_changes(-1);