Home >Web Front-end >JS Tutorial >How to perform other operations on the console provider_admin

How to perform other operations on the console provider_admin

坏嘻嘻
坏嘻嘻Original
2018-09-15 09:28:251530browse

本篇文章给大家带来的内容是关于如何进行对控制台provider_admin其他操作,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。

通过前面两篇文章分析了provider_admin里面服务启动过程,这篇我们把剩下的几个操作的实现做介绍,这里主要介绍list,status,stop,reload这四个操作,而额外的restart过程就是首先调用stop,后调用start的过程,不展开具体分析。先介绍stop过程。

function stopProvider($name)
{
	$masterPid = getProviderMasterPid($name);
	if (empty($masterPid))
	{
		waitProcessEnd($name);
	}
	else
	{
		if (!posix_kill(intval($masterPid), SIGTERM))
		{
			fwrite(STDERR, "end signal to {$name}: {$masterPid} failed" );
		}
		waitProcessEnd($name);
	}

	$masterFile = FSOF_PROVIDER_PID_PATH.$name.MASTER_PID_FILE_FORMAT;
	$managerFile = FSOF_PROVIDER_PID_PATH.$name.MANAGER_PID_FILE_FORMAT;
	if (file_exists($masterFile))
	{
		unlink($masterFile);
	}
	if (file_exists($managerFile))
	{
		unlink($managerFile);
	}
    echo "stop server {$name} \033[32;40m [SUCCESS] \033[0m".PHP_EOL;
}

The above is the detailed content of How to perform other operations on the console provider_admin. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn