php 运行 ipmi 命令滞后卡顿解决方案

	public function IPMIcommand($ip, $user, $password, $cmd)
	{
		if (!(ereg('^[[:alnum:] ]+', $cmd))) {
			throw new Exception('Invalid characters in command');
		}
		if (ereg('^bootdev ', $cmd)) {
			$cmd = 'chassis ' . $cmd;
		}

		$output = array();
		exec('/usr/bin/ipmitool -H ' . escapeshellarg($ip) . ' -U ' . escapeshellarg($user) . ' -P ' . escapeshellarg($password) . '' . ' ' . $cmd . ' 2>&1', $output);
		return implode("\n", $output);
	}

 看别人写代码, 解决了 10 年为啥php 命令跑起来会卡顿的疑惑

添加新评论 »