Closed xenion54 closed 5 months ago
<?php
use Workerman\Connection\TcpConnection;
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'Libs' . DIRECTORY_SEPARATOR . 'init.php';
$args = getopt('', ['port:']);
global $argv;
$argv[1] = 'start';
$argv[2] = '-d';
// The key
\Workerman\Worker::$pidFile= __DIR__ . '/worker.' . $args['port'] . '.pid';
$sw = new \Workerman\Worker('websocket://0.0.0.0:' . $args['port']);
$sw->count = 1;
$sw->onWorkerStart = function (\Workerman\Worker $worker) {
echo $args['arg1'] . PHP_EOL; // this line called only once
};
\Workerman\Worker::runAll();
@walkor thx, its work
On windows i can run script with same name multiple times (with different params). On linux, this doesn't work. After start first script, others scripts not starting. Event onWorkerStart called just first time. How can i run same script multiple times in linux?