/** * 运行 */ protected static function run() { LoadConfig::$config_file = self::$config_file; self::load_config(); self::register_signal(); if (self::$checktime) { $run = true; Main::log_write("正在启动..."); while ($run) { $s = date("s"); if ($s == 0) { TurnTable::init(); Crontab::load_config(); self::register_timer(); $run = false; } else { Main::log_write("启动倒计时 " . (60 - $s) . " 秒"); sleep(1); } } } else { TurnTable::init(); self::register_timer(); } self::get_pid(); self::write_pid(); }
/** * 运行 */ protected static function run() { self::$tasksHandle = new LoadTasks(strtolower(self::$taskType), self::$taskParams); self::register_signal(); if (self::$checktime) { $run = true; Main::log_write("正在启动..."); while ($run) { $s = date("s"); if ($s == 0) { TurnTable::init(); Crontab::load_config(); self::register_timer(); $run = false; } else { Main::log_write("启动倒计时 " . (60 - $s) . " 秒"); sleep(1); } } } else { TurnTable::init(); self::load_config(); self::register_timer(); } self::get_pid(); self::write_pid(); //开启worker if (self::$worker) { (new Worker())->loadWorker(); } }