Example #1
0
                 break;
             default:
                 break;
         }
     }
 }
 if (defined('IDLETIME')) {
     $idletime = IDLETIME;
 } else {
     $idletime = 600;
 }
 $pid = 0;
 $last = 0;
 $running = false;
 if (file_exists(BASE_FILE . "proc/{$role}.procinfo")) {
     $procfile = read_procfile(BASE_FILE . "proc/{$role}.procinfo");
     $pid = $procfile['pid'];
     $last = $procfile['last'];
     if ($pid == -1) {
         exit;
     }
     $running = script_lock($role, true) !== true;
     if ($running) {
         logit("controller.log", "script {$role} is running with pid [" . $pid . "] and has been idle for " . (time() - $last) . " seconds");
     }
     // check whether the process has been idle for too long
     $idled = $last < time() - $idletime ? true : false;
     if ($reload || $idled) {
         // record confirmed gap
         gap_record($role, $last, time());
         if ($running) {
Example #2
0
                 break;
             default:
                 break;
         }
     }
 }
 if (defined('IDLETIME')) {
     $idletime = IDLETIME;
 } else {
     $idletime = 600;
 }
 $pid = 0;
 $last = 0;
 $running = false;
 if (file_exists(__DIR__ . "/../../proc/{$role}.procinfo")) {
     $procfile = read_procfile(__DIR__ . "/../../proc/{$role}.procinfo");
     $pid = $procfile['pid'];
     $last = $procfile['last'];
     if ($pid == -1) {
         exit;
     }
     $running = script_lock($role, true) !== true;
     if ($running) {
         logit("controller.log", "script {$role} is running with pid [" . $pid . "] and has been idle for " . (time() - $last) . " seconds");
     }
     // check whether the process has been idle for too long
     $idled = $last < time() - $idletime ? true : false;
     if ($reload || $idled) {
         // record confirmed gap if we could measure it
         if ($last && gap_record($role, $last, time())) {
             logit("controller.log", "recording a data gap for script {$role} from '" . toDateTime($last) . "' to '" . toDateTime(time()) . "'");