本文整理汇总了PHP中execute_program函数的典型用法代码示例。如果您正苦于以下问题:PHP execute_program函数的具体用法?PHP execute_program怎么用?PHP execute_program使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了execute_program函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: network
function network()
{
$netstat_b = execute_program('netstat', '-nbdi | cut -c1-25,44- | grep Link | grep -v \'* \'');
$netstat_n = execute_program('netstat', '-ndi | cut -c1-25,44- | grep Link | grep -v \'* \'');
$lines_b = split("\n", $netstat_b);
$lines_n = split("\n", $netstat_n);
$results = array();
for ($i = 0, $max = sizeof($lines_b); $i < $max; $i++) {
$ar_buf_b = preg_split("/\\s+/", $lines_b[$i]);
$ar_buf_n = preg_split("/\\s+/", $lines_n[$i]);
if (!empty($ar_buf_b[0]) && !empty($ar_buf_n[3])) {
$results[$ar_buf_b[0]] = array();
$results[$ar_buf_b[0]]['rx_bytes'] = $ar_buf_b[3];
$results[$ar_buf_b[0]]['rx_packets'] = $ar_buf_n[3];
$results[$ar_buf_b[0]]['rx_errs'] = $ar_buf_n[4];
$results[$ar_buf_b[0]]['rx_drop'] = $ar_buf_n[8];
$results[$ar_buf_b[0]]['tx_bytes'] = $ar_buf_b[4];
$results[$ar_buf_b[0]]['tx_packets'] = $ar_buf_n[5];
$results[$ar_buf_b[0]]['tx_errs'] = $ar_buf_n[6];
$results[$ar_buf_b[0]]['tx_drop'] = $ar_buf_n[8];
$results[$ar_buf_b[0]]['errs'] = $ar_buf_n[4] + $ar_buf_n[6];
$results[$ar_buf_b[0]]['drop'] = $ar_buf_n[8];
}
}
return $results;
}
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:26,代码来源:class.OpenBSD.inc.php
示例2: memory
function memory()
{
$s = $this->grab_key('hw.physmem');
$pagesize = $this->grab_key('hw.pagesize');
$results['ram'] = array();
$pstat = execute_program('vmstat', '-s');
$lines = split("\n", $pstat);
for ($i = 0, $max = sizeof($lines); $i < $max; $i++) {
$ar_buf = preg_split("/\\s+/", $lines[$i], 19);
if ($i == 3) {
$results['ram']['free'] = $ar_buf[1] * $pagesize / 1024;
} elseif ($i == 19) {
$results['swap']['total'] = $ar_buf[1] * $pagesize / 1024;
} elseif ($i == 20) {
$results['swap']['used'] = $ar_buf[1] * $pagesize / 1024;
}
}
$results['ram']['total'] = $s / 1024;
$results['ram']['shared'] = 0;
$results['ram']['buffers'] = 0;
$results['ram']['used'] = $results['ram']['total'] - $results['ram']['free'];
$results['ram']['cached'] = 0;
$results['ram']['t_used'] = $results['ram']['used'];
$results['ram']['t_free'] = $results['ram']['free'];
$results['ram']['percent'] = round($results['ram']['used'] * 100 / $results['ram']['total']);
$results['swap']['free'] = $results['swap']['total'] - $results['swap']['used'];
$results['swap']['percent'] = round($results['swap']['used'] * 100 / $results['swap']['total']);
return $results;
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:29,代码来源:class.NetBSD.inc.php
示例3: network
public function network()
{
if (!execute_program('netstat', '-nibd | grep Link', $netstat, $this->debug)) {
$netstat = '';
}
$lines = split("\n", $netstat);
$results = array();
for ($i = 0, $max = sizeof($lines); $i < $max; $i++) {
$ar_buf = preg_split("/\\s+/", $lines[$i]);
if (!empty($ar_buf[0])) {
$results[$ar_buf[0]] = array();
if (strlen($ar_buf[3]) < 15) {
$results[$ar_buf[0]]['rx_bytes'] = $ar_buf[5];
$results[$ar_buf[0]]['tx_bytes'] = $ar_buf[8];
$results[$ar_buf[0]]['errs'] = $ar_buf[4] + $ar_buf[7];
$results[$ar_buf[0]]['drop'] = $ar_buf[10];
} else {
$results[$ar_buf[0]]['rx_bytes'] = $ar_buf[6];
$results[$ar_buf[0]]['tx_bytes'] = $ar_buf[9];
$results[$ar_buf[0]]['errs'] = $ar_buf[5] + $ar_buf[8];
$results[$ar_buf[0]]['drop'] = $ar_buf[11];
}
}
}
return $results;
}
开发者ID:rohdoor,项目名称:ehcp,代码行数:26,代码来源:class.FreeBSD.inc.php
示例4: parse_filesystems
function parse_filesystems()
{
global $show_bind, $show_inodes;
$j = 0;
$df = execute_program('df', '-k' . $this->df_param);
$df = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
if ($show_inodes) {
$df2 = execute_program('df', '-i' . $this->df_param);
$df2 = preg_split("/\n/", $df2, -1, PREG_SPLIT_NO_EMPTY);
}
$mount = execute_program('mount');
$mount = preg_split("/\n/", $mount, -1, PREG_SPLIT_NO_EMPTY);
foreach ($df as $df_line) {
$df_buf1 = preg_split("/(\\%\\s)/", $df_line, 2);
if (count($df_buf1) != 2) {
continue;
}
preg_match("/(.*)(\\s+)(([0-9]+)(\\s+)([0-9]+)(\\s+)([0-9]+)(\\s+)([0-9]+)\$)/", $df_buf1[0], $df_buf2);
$df_buf = array($df_buf2[1], $df_buf2[4], $df_buf2[6], $df_buf2[8], $df_buf2[10], $df_buf1[1]);
if ($show_inodes) {
preg_match_all("/([0-9]+)%/", $df2[$j + 1], $inode_buf, PREG_SET_ORDER);
}
if (count($df_buf) == 6) {
if (hide_mount($df_buf[5])) {
continue;
}
$df_buf[0] = trim(str_replace("\$", "\\\$", $df_buf[0]));
$df_buf[5] = trim($df_buf[5]);
$current = 0;
foreach ($mount as $mount_line) {
$current++;
if (preg_match("#" . $df_buf[0] . " on " . $df_buf[5] . " type (.*) \\((.*)\\)#", $mount_line, $mount_buf)) {
$mount_buf[1] .= "," . $mount_buf[2];
} elseif (!preg_match("#" . $df_buf[0] . "(.*) on " . $df_buf[5] . " \\((.*)\\)#", $mount_line, $mount_buf)) {
continue;
}
if ($show_bind || !stristr($mount_buf[2], "bind")) {
$results[$j] = array();
$results[$j]['disk'] = str_replace("\\\$", "\$", $df_buf[0]);
$results[$j]['size'] = $df_buf[1];
$results[$j]['used'] = $df_buf[2];
$results[$j]['free'] = $df_buf[3];
$results[$j]['percent'] = round($results[$j]['used'] * 100 / $results[$j]['size']);
$results[$j]['mount'] = $df_buf[5];
$results[$j]['fstype'] = substr($mount_buf[1], 0, strpos($mount_buf[1], ","));
$results[$j]['options'] = substr($mount_buf[1], strpos($mount_buf[1], ",") + 1, strlen($mount_buf[1]));
if ($show_inodes && isset($inode_buf[count($inode_buf) - 1][1])) {
$results[$j]['inodes'] = $inode_buf[count($inode_buf) - 1][1];
}
$j++;
unset($mount[$current - 1]);
sort($mount);
break;
}
}
}
}
return $results;
}
开发者ID:shamimhasan,项目名称:Vtiger-CRM-5.4.0,代码行数:59,代码来源:class.parseProgs.inc.php
示例5: mbinfo
function mbinfo() {
$lines = execute_program("sensors", "");
// Martijn Stolk: Dirty fix for misinterpreted output of sensors,
// where info could come on next line when the label is too long.
$lines = str_replace(":\n", ":", $lines);
$lines = str_replace("\n\n", "\n", $lines);
$this->lines = explode("\n", $lines);
}
开发者ID:nixonch,项目名称:a2billing,代码行数:8,代码来源:class.lmsensors.inc.php
示例6: __construct
function __construct()
{
if (execute_program('sysctl', '-w hw.sensors', $this->lines)) {
$this->lines = explode("\n", $this->lines);
} else {
$this->lines = array();
}
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:8,代码来源:class.HWSensors.inc.php
示例7: __construct
public function __construct()
{
$output = array();
$upses = explode(',', PSI_UPSINFO_APCUPSD_UPS_LIST);
$temp = '';
for ($i = 0; $i < count($upses); $i++) {
execute_program('apcaccess', 'status ' . trim($upses[$i]), $temp);
if (isset($temp) && !empty($temp)) {
$this->output[$i] = $temp;
}
}
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:12,代码来源:class.apcupsd.inc.php
示例8: temperature
function temperature($hddtemp_avail)
{
$ar_buf = array();
$results = array();
switch ($hddtemp_avail) {
case "tcp":
// Timo van Roermund: connect to the hddtemp daemon, use a 5 second timeout.
$fp = fsockopen('localhost', 7634, $errno, $errstr, 5);
// if connected, read the output of the hddtemp daemon
if ($fp) {
// read output of the daemon
$lines = '';
while (!feof($fp)) {
$lines .= fread($fp, 1024);
}
// close the connection
fclose($fp);
} else {
die("HDDTemp error: " . $errno . ", " . $errstr);
}
$lines = str_replace("||", "|\n|", $lines);
$ar_buf = explode("\n", $lines);
break;
case "suid":
$hddtemp_value = execute_program("hddtemp", "{$this->strDrives}");
$hddtemp_value = explode("\n", $hddtemp_value);
foreach ($hddtemp_value as $line) {
$temp = preg_split("/:\\s/", $line, 3);
if (preg_match("/^[0-9]/", $temp[2])) {
list($temp[2], $temp[3]) = preg_split("/\\s/", $temp[2]);
array_push($ar_buf, "|" . implode("|", $temp) . "|");
}
}
break;
default:
die("Bad hddtemp configuration in config.php");
}
// Timo van Roermund: parse the info from the hddtemp daemon.
$i = 0;
foreach ($ar_buf as $line) {
$data = array();
if (ereg("\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|", $line, $data)) {
if (trim($data[3]) != "ERR") {
// get the info we need
$results[$i]['label'] = $data[1];
$results[$i]['value'] = $data[3];
$results[$i]['model'] = $data[2];
$i++;
}
}
}
return $results;
}
开发者ID:sorrowchen,项目名称:openfiler-cn,代码行数:53,代码来源:class.hddtemp.inc.php
示例9: temperature
function temperature()
{
$results = array();
$smp = 1;
execute_program('sysctl', '-n kern.smp.cpus', $smp);
for ($i = 0; $i < $smp; $i++) {
$temp = 0;
if (execute_program('sysctl', '-n dev.cpu.' . $i . '.temperature', $temp)) {
$results[$i]['label'] = "CPU " . ($i + 1);
$results[$i]['value'] = $temp;
$results[$i]['limit'] = '70.0';
$results[$i]['percent'] = $results[$i]['value'] * 100 / $results[$i]['limit'];
}
}
return $results;
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:16,代码来源:class.coretemp.inc.php
示例10: voltage
function voltage()
{
$lines = array();
$results = array();
$lines = explode("\n", execute_program('mbmon', '-c 1 -r'));
$i = 0;
foreach ($lines as $line) {
if (preg_match('/^(V.*)\\s*:\\s*(.*)$/D', $line, $data)) {
if ($data[2] != '+0.00') {
$results[$i]['label'] = $data[1];
$results[$i]['value'] = $data[2];
$results[$i]['min'] = '0.00';
$results[$i]['max'] = '0.00';
$i++;
}
}
}
return $results;
}
开发者ID:BackupTheBerlios,项目名称:baifox-svn,代码行数:19,代码来源:class.mbmon.inc.php
示例11: voltage
function voltage()
{
$buf = array();
$ar_buf = array();
$lines = array();
$results = array();
$buf = execute_program('sysctl', '-w hw.sensors');
$lines = explode("\n", $buf);
for ($i = 0, $j = 0, $max = sizeof($lines); $i < $max; $i++) {
$ar_buf = preg_split("/[\\s,]+/", $lines[$i]);
if ($ar_buf[2] == 'volts_dc') {
$results[$j]['label'] = $ar_buf[1];
$results[$j]['value'] = $ar_buf[3];
$results[$j]['min'] = '0.00';
$results[$j]['max'] = '0.00';
$j++;
}
}
return $results;
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:20,代码来源:class.hwsensors.inc.php
示例12: network
public function network()
{
execute_program('netstat', '-nbdi | cut -c1-25,44- | grep "^[a-z]*[0-9][ \\t].*Link"', $netstat_b);
execute_program('netstat', '-ndi | cut -c1-25,44- | grep "^[a-z]*[0-9][ \\t].*Link"', $netstat_n);
$lines_b = explode("\n", $netstat_b);
$lines_n = explode("\n", $netstat_n);
$results = array();
for ($i = 0, $max = sizeof($lines_b); $i < $max; $i++) {
$ar_buf_b = preg_split("/\\s+/", $lines_b[$i]);
$ar_buf_n = preg_split("/\\s+/", $lines_n[$i]);
if (!empty($ar_buf_b[0]) && !empty($ar_buf_n[3])) {
$results[$ar_buf_b[0]] = array();
$results[$ar_buf_b[0]]['rx_bytes'] = $ar_buf_b[3];
$results[$ar_buf_b[0]]['tx_bytes'] = $ar_buf_b[4];
$results[$ar_buf_b[0]]['errs'] = $ar_buf_n[4] + $ar_buf_n[6];
$results[$ar_buf_b[0]]['drop'] = $ar_buf_n[8];
}
}
return $results;
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:20,代码来源:class.NetBSD.inc.php
示例13: voltage
function voltage()
{
$ar_buf = array();
$results = array();
if (!isset($this->lines)) {
$this->lines = execute_program('healthdc', '-t');
}
$ar_buf = preg_split("/\t+/", $this->lines);
$results[0]['label'] = 'Vcore1';
$results[0]['value'] = $ar_buf[7];
$results[0]['min'] = '0.00';
$results[0]['max'] = '0.00';
$results[1]['label'] = 'Vcore2';
$results[1]['value'] = $ar_buf[8];
$results[1]['min'] = '0.00';
$results[1]['max'] = '0.00';
$results[2]['label'] = '3volt';
$results[2]['value'] = $ar_buf[9];
$results[2]['min'] = '0.00';
$results[2]['max'] = '0.00';
$results[3]['label'] = '+5Volt';
$results[3]['value'] = $ar_buf[10];
$results[3]['min'] = '0.00';
$results[3]['max'] = '0.00';
$results[4]['label'] = '+12Volt';
$results[4]['value'] = $ar_buf[11];
$results[4]['min'] = '0.00';
$results[4]['max'] = '0.00';
$results[5]['label'] = '-12Volt';
$results[5]['value'] = $ar_buf[12];
$results[5]['min'] = '0.00';
$results[5]['max'] = '0.00';
$results[6]['label'] = '-5Volt';
$results[6]['value'] = $ar_buf[13];
$results[6]['min'] = '0.00';
$results[6]['max'] = '0.00';
return $results;
}
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:38,代码来源:class.healthd.inc.php
示例14: network
function network()
{
$netstat = execute_program('netstat', '-nbdi | cut -c1-24,42- | grep Link');
$lines = split("\n", $netstat);
$results = array();
for ($i = 0; $i < sizeof($lines); $i++) {
$ar_buf = preg_split("/\\s+/", $lines[$i]);
if (!empty($ar_buf[0]) && !empty($ar_buf[3])) {
$results[$ar_buf[0]] = array();
$results[$ar_buf[0]]['rx_bytes'] = $ar_buf[5];
$results[$ar_buf[0]]['rx_packets'] = $ar_buf[3];
$results[$ar_buf[0]]['rx_errs'] = $ar_buf[4];
$results[$ar_buf[0]]['rx_drop'] = $ar_buf[10];
$results[$ar_buf[0]]['tx_bytes'] = $ar_buf[8];
$results[$ar_buf[0]]['tx_packets'] = $ar_buf[6];
$results[$ar_buf[0]]['tx_errs'] = $ar_buf[7];
$results[$ar_buf[0]]['tx_drop'] = $ar_buf[10];
$results[$ar_buf[0]]['errs'] = $ar_buf[4] + $ar_buf[7];
$results[$ar_buf[0]]['drop'] = $ar_buf[10];
}
}
return $results;
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:23,代码来源:class.FreeBSD.inc.php
示例15: voltage
public function voltage()
{
$results = array();
if (!isset($this->lines)) {
execute_program('mbmon', '-c 1 -r', $this->lines);
$this->lines = explode("\n", $this->lines);
}
if (empty($this->lines)) {
return null;
}
$i = 0;
foreach ($this->lines as $line) {
if (preg_match('/^(V.*)\\s*:\\s*(.*)$/D', $line, $data)) {
if ($data[2] != '+0.00') {
$results[$i]['label'] = $data[1];
$results[$i]['value'] = $data[2];
$results[$i]['min'] = '0.00';
$results[$i]['max'] = '0.00';
$i++;
}
}
}
return $results;
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:24,代码来源:class.mbmon.inc.php
示例16: usb
function usb()
{
$results = array();
$devnum = -1;
$bufr = execute_program('lsusb', '', false);
if ($bufr == "ERROR") {
$bufr = rfts('/proc/bus/usb/devices');
if ($bufr != "ERROR") {
$bufe = explode("\n", $bufr);
foreach ($bufe as $buf) {
if (preg_match('/^T/', $buf)) {
$devnum += 1;
$results[$devnum] = "";
} elseif (preg_match('/^S:/', $buf)) {
list($key, $value) = split(': ', $buf, 2);
list($key, $value2) = split('=', $value, 2);
if (trim($key) != "SerialNumber") {
$results[$devnum] .= " " . trim($value2);
$devstring = 0;
}
}
}
}
} else {
$bufe = explode("\n", $bufr);
foreach ($bufe as $buf) {
$device = preg_split("/ /", $buf, 7);
if (isset($device[6]) && trim($device[6]) != "") {
$results[$devnum++] = trim($device[6]);
}
}
}
return $results;
}
开发者ID:sorrowchen,项目名称:openfiler-cn,代码行数:34,代码来源:class.Linux.inc.php
示例17: filesystems
function filesystems()
{
$results = array();
$df = execute_program('df', '-kP');
$mounts = split("\n", $df);
$fstype = array();
if ($fd = fopen('/proc/mounts', 'r')) {
while ($buf = fgets($fd, 4096)) {
list($dev, $mpoint, $type) = preg_split('/\\s+/', trim($buf), 4);
$fstype[$mpoint] = $type;
$fsdev[$dev] = $type;
}
fclose($fd);
}
for ($i = 1; $i < sizeof($mounts); $i++) {
$ar_buf = preg_split('/\\s+/', $mounts[$i], 6);
$results[$i - 1] = array();
$results[$i - 1]['disk'] = $ar_buf[0];
$results[$i - 1]['size'] = $ar_buf[1];
$results[$i - 1]['used'] = $ar_buf[2];
$results[$i - 1]['free'] = $ar_buf[3];
$results[$i - 1]['percent'] = round($results[$i - 1]['used'] * 100 / $results[$i - 1]['size']) . '%';
$results[$i - 1]['mount'] = $ar_buf[5];
$fstype[$ar_buf[5]] ? $results[$i - 1]['fstype'] = $fstype[$ar_buf[5]] : ($results[$i - 1]['fstype'] = $fsdev[$ar_buf[0]]);
}
return $results;
}
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:27,代码来源:sysinfo-Kernel-2.6.php
示例18: network
public function network()
{
if (execute_program('netstat', '-nbdi | cut -c1-24,42- | grep Link', $netstat, $this->debug)) {
$lines = split("\n", $netstat);
$results = array();
for ($i = 0, $max = sizeof($lines); $i < $max; $i++) {
$ar_buf = preg_split("/\\s+/", $lines[$i], 10);
if (!empty($ar_buf[0])) {
$results[$ar_buf[0]] = array();
$results[$ar_buf[0]]['rx_bytes'] = $ar_buf[5];
$results[$ar_buf[0]]['tx_bytes'] = $ar_buf[8];
$results[$ar_buf[0]]['errs'] = $ar_buf[4] + $ar_buf[7];
$results[$ar_buf[0]]['drop'] = isset($ar_buf[10]) ? $ar_buf[10] : 0;
}
}
return $results;
} else {
return array();
}
}
开发者ID:rohdoor,项目名称:ehcp,代码行数:20,代码来源:class.Darwin.inc.php
示例19: filesystems
function filesystems()
{
$df = execute_program('df', '-k');
$mounts = split("\n", $df);
$fstype = array();
$s = execute_program('mount');
$lines = explode("\n", $s);
$i = 0;
while (list(, $line) = each($lines)) {
ereg('(.*) \\((.*)\\)', $line, $a);
$m = explode(' ', $a[0]);
$fsdev[$m[0]] = $a[2];
}
for ($i = 1, $j = 0; $i < sizeof($mounts); $i++) {
$ar_buf = preg_split("/\\s+/", $mounts[$i], 6);
switch ($ar_buf[0]) {
case 'automount':
// skip the automount entries
// skip the automount entries
case 'devfs':
// skip the dev filesystem
// skip the dev filesystem
case 'fdesc':
// skip the fdesc
// skip the fdesc
case 'procfs':
// skip the proc filesystem
// skip the proc filesystem
case '<volfs>':
// skip the vol filesystem
continue 2;
break;
}
$results[$j] = array();
$results[$j]['disk'] = $ar_buf[0];
$results[$j]['size'] = $ar_buf[1];
$results[$j]['used'] = $ar_buf[2];
$results[$j]['free'] = $ar_buf[3];
$results[$j]['percent'] = $ar_buf[4];
$results[$j]['mount'] = $ar_buf[5];
$fstype[$ar_buf[5]] ? $results[$j]['fstype'] = $fstype[$ar_buf[5]] : ($results[$j]['fstype'] = $fsdev[$ar_buf[0]]);
$j++;
}
return $results;
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:45,代码来源:class.Darwin.inc.php
示例20: ScanNodes
public function ScanNodes()
{
$result = array();
$networks = $this->GetNetworks();
if ($networks) {
$node_manager = new LMSNodeManager($this->db, $this->auth, $this->cache, $this->syslog);
foreach ($networks as $idx => $network) {
if ($res = execute_program('nbtscan', '-q -s: ' . $network['address'] . '/' . $network['prefix'])) {
$out = explode("\n", $res);
foreach ($out as $line) {
list($ipaddr, $name, $null, $login, $mac) = explode(':', $line, 5);
$row['ipaddr'] = trim($ipaddr);
if ($row['ipaddr']) {
$row['name'] = trim($name);
$row['mac'] = strtoupper(str_replace('-', ':', trim($mac)));
if ($row['mac'] != "00:00:00:00:00:00" && !$node_manager->GetNodeIDByIP($row['ipaddr'])) {
$result[] = $row;
}
}
}
}
}
}
return $result;
}
开发者ID:pjona,项目名称:lms,代码行数:25,代码来源:LMSNetworkManager.php
注:本文中的execute_program函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论