Ejemplo n.º 1
0
 private static function run()
 {
     self::get_pid();
     self::write_pid();
     self::params_config();
     foreach (self::$task_list as $task => $data) {
         self::create_child_process($task, $data);
     }
     self::register_signal();
     self::$start = true;
 }
Ejemplo n.º 2
0
 /**
  * 解析启动模式参数
  * @param $opt
  */
 public static function params_s($opt)
 {
     //判断传入了s参数但是值,则提示错误
     if (isset($opt["s"]) && !$opt["s"] || isset($opt["s"]) && !in_array($opt["s"], array("start", "stop", "restart"))) {
         Main::log_write("Please run: path/to/php main.php -s [start|stop|restart]");
     }
     if (isset($opt["s"]) && in_array($opt["s"], array("start", "stop", "restart"))) {
         switch ($opt["s"]) {
             case "start":
                 Squire_Master::start();
                 break;
             case "stop":
                 Squire_Master::stop();
                 break;
             case "restart":
                 Squire_Master::restart();
                 break;
         }
     }
 }