Bootstrap\Worker::onStart PHP Method

onStart() public method

swoole_start 回调函数
public onStart ( swoole_server $serv )
$serv swoole_server
    public function onStart(\swoole_server $serv)
    {
        //设置主进程名称
        global $argv;
        swoole_set_process_name("php {$argv[0]}: statistics_master");
        //保存进程master_pid文件比较好操作
        file_put_contents(BASEDIR . $this->masterPidPath, $serv->master_pid);
        echo "\n----------------------- SWOOLE -----------------------------\n";
        echo 'swoole version:' . swoole_version() . "          PHP version:" . PHP_VERSION . "\n";
        echo "------------------------ WORKERS ---------------------------\n";
        echo "MasterPid", str_pad('', self::$_maxMasterPidLength + 2 - strlen('MasterPid')), "ManagerPid", str_pad('', self::$_maxManagerPidLength + 2 - strlen('ManagerPid')), "WorkerId", str_pad('', self::$_maxWorkerIdLength + 2 - strlen('WorkerId')), "WorkerPid\n";
    }