gearmand php Worker & Client

Worker.php
<?php
$worker= new GearmanWorker();
$worker->addServer();
$worker->addFunction(“sendMsn”, “sendMSN_function”);
while ($worker->work());

function sendMSN_function($job)
{
$subject = ucwords(strtolower($job->workload()));
exec(“echo $subject >>/opt/phpdba/www/html/cacti/plugins/thold/alter.log”);
exec(“sh /opt/phpdba/sendMsg/sendMsg.sh >>/opt/sendMsg/sendmsg.log 2>&1”);
return ;
}
?>

Client.php

<?php
$client= new GearmanClient();
$client->addServer();
$client->do(“sendMsn”, $subject);
?>

 

此条目发表在技术生涯分类目录,贴了, 标签。将固定链接加入收藏夹。

发表评论

邮箱地址不会被公开。 必填项已用*标注