daemonize

Description:

static bool Worker::$daemonize

This property is a global static property that indicates whether to run in daemon mode. If the startup command uses the -d parameter, this property will be automatically set to true. It can also be manually set in the code.

Note: This property must be set before Worker::runAll(); is executed to take effect. This feature is not supported on Windows systems.

Example

use Workerman\Worker;
use Workerman\Connection\TcpConnection;
require_once __DIR__ . '/vendor/autoload.php';

Worker::$daemonize = true;
$worker = new Worker('text://0.0.0.0:8484');
$worker->onWorkerStart = function($worker)
{
    echo "Worker start\n";
};
// Run worker
Worker::runAll();