ProcessUtil
class ProcessUtil
Class ProcessUtil
Properties
static array | $signalMap |
Methods
No description
No description
run a command. it is support windows
run a command in background
No description
fork/create multi child processes.
No description
fork/create a child process.
wait child exit.
Stops all running children
send kill signal to the process
Do shutdown process and wait it exit.
杀死所有进程
No description
exit
send signal to the process
install signal
dispatch signal
get current process id
get Pid from File
Get unix user of current process.
No description
Set process title.
Set process title.
Set unix user and group for current process script.
Details
at line 30
static bool
hasPcntl()
at line 38
static bool
hasPosix()
at line 49
static array
run(string $command, string $cwd = null)
run a command. it is support windows
at line 87
static int
daemonRun(Closure $beforeQuit = null)
Daemon, detach and run in the background
at line 128
static int|string
runInBackground(string $cmd)
run a command in background
at line 146
static array|false
multi(int $number, callable $onStart = null, callable $onError = null)
at line 158
static array|false
forks(int $number, callable $onStart = null, callable $onError = null)
fork/create multi child processes.
at line 185
static array|false
create(callable $onStart = null, callable $onError = null, int $id = 0)
at line 197
static array|false
fork(callable $onStart = null, callable $onError = null, int $id = 0)
fork/create a child process.
at line 235
static bool
wait(callable $onExit)
wait child exit.
at line 279
static bool
stopWorkers(array $children, int $signal = SIGTERM, array $events = [])
Stops all running children
at line 321
static bool
kill(int $pid, bool $force = false, int $timeout = 3)
send kill signal to the process
at line 335
static bool
killAndWait(int $pid, $error = null, $name = 'process', bool $force = false, int $waitTime = 10)
Do shutdown process and wait it exit.
at line 384
static string
killByName(string $name, int $sigNo = 9)
杀死所有进程
at line 396
static bool
isRunning(int $pid)
at line 405
static
quit(int $code = 0)
exit
at line 421
static bool
sendSignal(int $pid, int $signal, int $timeout = 0)
send signal to the process
at line 467
static bool
installSignal(int $signal, callable $handler)
install signal
at line 480
static bool
dispatchSignal()
dispatch signal
at line 498
static int
getPid()
get current process id
at line 509
static int
getPidByFile(string $file, bool $checkLive = false)
get Pid from File
at line 529
static array
getCurrentUser()
Get unix user of current process.
at line 539
static bool|int
afterDo(int $seconds, callable $handler)
at line 564
static bool
setName(string $title)
Set process title.
at line 574
static bool
setTitle(string $title)
Set process title.
at line 593
static
changeScriptOwner(string $user, string $group = '')
Set unix user and group for current process script.