with('provider')->find(self::$code); if ($maker) { SupervisorMaker::run($supervisor); } if ($supervisor) { if ($debug) { Notice::note('supervisor start '.self::$code, 'g'); } $tmp = $supervisor->toArray(); unset($tmp['id']); $options = array_merge($options, $tmp); if ($proxy) { $options['proxy'] = 'https://prox2.nuhodds.com/proxy.php'; } if ($options['sleep'] > 0) { if (! $debug) { sleep($options['sleep']); } else { if ($options['is_supervisor']) { Notice::note('cron process timings set in crontab', 'b'); } else { Notice::note('in production process sleeps for '.$options['sleep'].'sec', 'b'); } } } if (! $options['is_active']) { Notice::note('Process disabled, sleeps 2 min then exit', 'r'); sleep(120); exit; } } else { Notice::note('unknown supervisor: '.self::$code, 'r', 1); } } public static function end($options) { $processend = microtime(true); $runtime = round(($processend - self::$starttime) / 60, 3); Supervisor::where('id', self::$code)->update(['runtime' => $runtime]); if ($options['d']) { Notice::note('spervisor time: '.$runtime.' min', 'g'); } } }