The GearmanWorker class

(PECL gearman >= 0.5.0)

소개

클래스 개요

GearmanWorker {
/* 메소드 */
public bool addFunction ( string $function_name , callable $function [, mixed &$context [, int $timeout ]] )
public bool addOptions ( int $option )
public bool addServer ([ string $host = 127.0.0.1 [, int $port = 4730 ]] )
public bool addServers ( string $servers = 127.0.0.1:4730 )
public void clone ( void )
public __construct ( void )
public bool echo ( string $workload )
public string error ( void )
public int getErrno ( void )
public int options ( void )
public bool register ( string $function_name [, int $timeout ] )
public bool removeOptions ( int $option )
public int returnCode ( void )
public bool setId ( string $id )
public bool setOptions ( int $option )
public bool setTimeout ( int $timeout )
public int timeout ( void )
public bool unregister ( string $function_name )
public bool unregisterAll ( void )
public bool wait ( void )
public bool work ( void )
}

Table of Contents

add a note add a note

User Contributed Notes 2 notes

up
1
szhvoj@gmail!com
2 years ago
Use systemd for managing this process:

---- 8< ---- /lib/systemd/system/gearman-worker.service
[Unit]
Description=My own gearman worker

[Service]
ExecStart=/usr/bin/php /var/www/my-worker.php
Restart=always

[Install]
WantedBy=multi-user.target
---- >8 ----  /lib/systemd/system/gearman-worker.service
systemctl daemon-reload
systemctl enable gearman-worker
systemctl start gearman-worker
up
-5
spacewalker2002 at ukr dot net
11 years ago
For background run use:

exec("nohup php worker.php >/dev/null 2>/dev/null &");
To Top