• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mwexec2函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中mwexec2函数的典型用法代码示例。如果您正苦于以下问题:PHP mwexec2函数的具体用法?PHP mwexec2怎么用?PHP mwexec2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了mwexec2函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: zfs_dataset_display_properties

function zfs_dataset_display_properties()
{
    mwexec2("zfs list -H -o name -t filesystem 2>&1", $rawdata);
    $vols = implode(" ", $rawdata);
    mwexec2("zfs get all {$vols} 2>&1", $rawdata2);
    return implode("\n", $rawdata2);
}
开发者ID:rterbush,项目名称:nas4free,代码行数:7,代码来源:disks_zfs_dataset_info.php


示例2: zfs_volume_display_properties

function zfs_volume_display_properties()
{
    mwexec2("zfs list -H -o name -t volume 2>&1", $rawdata);
    $vols = implode(" ", $rawdata);
    mwexec2("zfs get all {$vols} 2>&1", $rawdata2);
    return implode("\n", $rawdata2);
}
开发者ID:rterbush,项目名称:nas4free,代码行数:7,代码来源:disks_zfs_volume_info.php


示例3: get_zfs_snapshots

function get_zfs_snapshots()
{
    $result = array();
    mwexec2("zfs list -H -o name,used,creation -t snapshot 2>&1", $rawdata);
    foreach ($rawdata as $line) {
        $a = preg_split("/\t/", $line);
        $r = array();
        $name = $a[0];
        $r['snapshot'] = $name;
        if (preg_match('/^([^\\/\\@]+)(\\/([^\\@]+))?\\@(.*)$/', $name, $m)) {
            $r['pool'] = $m[1];
            $r['name'] = $m[4];
            $r['path'] = $m[1] . $m[2];
        } else {
            $r['pool'] = 'unknown';
            // XXX
            $r['name'] = 'unknown';
            // XXX
            $r['path'] = $name;
        }
        $r['used'] = $a[1];
        $r['creation'] = $a[2];
        $result[] = $r;
    }
    return $result;
}
开发者ID:rterbush,项目名称:nas4free,代码行数:26,代码来源:disks_zfs_snapshot.php


示例4: get_all_hast

function get_all_hast()
{
    $a = array();
    $a[''] = gettext("Must choose one");
    mwexec2("hastctl dump | grep resource", $rawdata);
    foreach ($rawdata as $line) {
        $hast = preg_split("/\\s/", $line);
        $name = $hast[1];
        $file = "/dev/hast/{$name}";
        if (file_exists($file)) {
            $diskinfo = disks_get_diskinfo($file);
            $size = $diskinfo[mediasize_mbytes];
            if ($size > 1024) {
                $size = (int) ($size / 1024);
                $size .= "GB";
            } else {
                $size .= "MB";
            }
        } else {
            $size = "(secondary)";
        }
        $a[$file] = htmlspecialchars("{$name}: {$size}");
    }
    return $a;
}
开发者ID:sdoney,项目名称:nas4free,代码行数:25,代码来源:disks_mount_edit.php


示例5: zfs_snapshot_display_properties

function zfs_snapshot_display_properties()
{
    mwexec2("zfs list -H -o name -t snapshot 2>&1", $rawdata);
    $snaps = implode(" ", $rawdata);
    $rawdata2 = array();
    if (!empty($snaps)) {
        mwexec2("zfs get all {$snaps} 2>&1", $rawdata2);
    }
    return implode("\n", $rawdata2);
}
开发者ID:rterbush,项目名称:nas4free,代码行数:10,代码来源:disks_zfs_snapshot_info.php


示例6: zfs_zpool_get_iostat

function zfs_zpool_get_iostat()
{
    // Get zpool I/O statistic informations
    $cmd = "zpool iostat -v 2>&1";
    if (isset($_GET['pool'])) {
        $cmd .= " {$_GET['pool']}";
    }
    mwexec2($cmd, $rawdata);
    return implode("\n", $rawdata);
}
开发者ID:rterbush,项目名称:nas4free,代码行数:10,代码来源:disks_zfs_zpool_io.php


示例7: hast_get_status

function hast_get_status()
{
    global $config;
    if (!isset($config['hast']['enable'])) {
        return gettext("HAST disabled");
    }
    $cmd = "/sbin/hastctl status";
    if (isset($_GET['name'])) {
        $cmd .= " {$_GET['name']}";
    }
    $cmd .= " 2>&1";
    mwexec2($cmd, $rawdata);
    return implode("\n", $rawdata);
}
开发者ID:sdoney,项目名称:nas4free,代码行数:14,代码来源:services_hast_info.php


示例8: zfs_zpool_get_status

function zfs_zpool_get_status()
{
    global $config;
    array_sort_key($config['zfs']['pools']['pool'], "name");
    array_sort_key($config['zfs']['vdevices']['vdevice'], "name");
    $a_pool = $config['zfs']['pools']['pool'];
    $a_vdevice = $config['zfs']['vdevices']['vdevice'];
    // Get zpool status informations
    $cmd = "zpool status -v";
    if (isset($_GET['pool'])) {
        $cmd .= " {$_GET['pool']}";
    }
    mwexec2($cmd, $rawdata);
    return implode("\n", $rawdata);
}
开发者ID:rterbush,项目名称:nas4free,代码行数:15,代码来源:disks_zfs_zpool_info.php


示例9: ismounted_or_dataset

function ismounted_or_dataset($path)
{
    if (disks_ismounted_ex($path, "mp")) {
        return true;
    }
    mwexec2("/sbin/zfs list -H -o mountpoint", $rawdata);
    foreach ($rawdata as $line) {
        $mp = trim($line);
        if ($mp == "-") {
            conitnue;
        }
        if ($path == $mp) {
            return true;
        }
    }
    return false;
}
开发者ID:sdoney,项目名称:nas4free,代码行数:17,代码来源:services_nfs_share_edit.php


示例10: get_zfs_paths

function get_zfs_paths()
{
    $result = array();
    mwexec2("zfs list -H -o name -t filesystem,volume 2>&1", $rawdata);
    foreach ($rawdata as $line) {
        $a = preg_split("/\t/", $line);
        $r = array();
        $name = $a[0];
        $r['path'] = $name;
        if (preg_match('/^([^\\/\\@]+)(\\/([^\\@]+))?$/', $name, $m)) {
            $r['pool'] = $m[1];
        } else {
            $r['pool'] = 'unknown';
            // XXX
        }
        $result[] = $r;
    }
    return $result;
}
开发者ID:rterbush,项目名称:nas4free,代码行数:19,代码来源:disks_zfs_snapshot_add.php


示例11: rcconf_process_updatenotification

function rcconf_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
        case UPDATENOTIFY_MODE_MODIFIED:
            break;
        case UPDATENOTIFY_MODE_DIRTY:
            if (is_array($config['system']['rcconf']['param'])) {
                $index = array_search_ex($data, $config['system']['rcconf']['param'], "uuid");
                if (false !== $index) {
                    mwexec2("/usr/local/sbin/rconf attribute remove {$config['system']['rcconf']['param'][$index]['name']}");
                    unset($config['system']['rcconf']['param'][$index]);
                    write_config();
                }
            }
            break;
    }
    return $retval;
}
开发者ID:rterbush,项目名称:nas4free,代码行数:21,代码来源:system_rcconf.php


示例12: get_mount_info

function get_mount_info($path)
{
    if (file_exists($path) === FALSE) {
        return FALSE;
    }
    // get all mount points
    $a_mounts = array();
    mwexec2('/sbin/mount -p', $rawdata);
    foreach ($rawdata as $line) {
        list($dev, $dir, $fs, $opt, $dump, $pass) = preg_split('/\\s+/', $line);
        $a_mounts[] = array('dev' => $dev, 'dir' => $dir, 'fs' => $fs, 'opt' => $opt, 'dump' => $dump, 'pass' => $pass);
    }
    if (empty($a_mounts)) {
        return FALSE;
    }
    // check path with mount list
    do {
        foreach ($a_mounts as $mountv) {
            if (strcmp($mountv['dir'], $path) == 0) {
                // found mount point
                return $mountv;
            }
        }
        // path don't have parent?
        if (strpos($path, '/') === FALSE) {
            break;
        }
        // retry with parent
        $pathinfo = pathinfo($path);
        $path = $pathinfo['dirname'];
    } while (1);
    return FALSE;
}
开发者ID:BillTheBest,项目名称:OpenNAS,代码行数:33,代码来源:services_samba_share_edit.php


示例13: get_all_hast

function get_all_hast($a_extent, $uuid)
{
    $a = array();
    $a[''] = gettext("Must choose one");
    mwexec2("hastctl dump | grep resource", $rawdata);
    foreach ($rawdata as $line) {
        $hast = preg_split("/\\s/", $line);
        $name = $hast[1];
        $file = "/dev/hast/{$name}";
        if (file_exists($file)) {
            $diskinfo = disks_get_diskinfo($file);
            $size = $diskinfo[mediasize_mbytes];
            if ($size > 1024) {
                $size = (int) ($size / 1024);
                $size .= "GB";
            } else {
                $size .= "MB";
            }
        } else {
            $size = "(secondary)";
        }
        $index = array_search_ex($file, $a_extent, "path");
        if (FALSE !== $index) {
            if (!isset($uuid)) {
                continue;
            }
            if ($a_extent[$index]['uuid'] != $uuid) {
                continue;
            }
        }
        $a[$file] = htmlspecialchars("{$name}: {$size}");
    }
    return $a;
}
开发者ID:rterbush,项目名称:nas4free,代码行数:34,代码来源:services_iscsitarget_extent_edit.php


示例14: execCmd

function execCmd($cmd)
{
    mwexec2("{$cmd} 2>&1", $output, $status);
    return implode("\n", $output);
}
开发者ID:BillTheBest,项目名称:OpenNAS,代码行数:5,代码来源:hast_alerts.php


示例15: unset

    if (is_array($config['bhyve'])) {
        unset($config['bhyve']);
        write_config();
        header("Location: /");
        exit;
    }
} elseif (!is_file("/tmp/bhyve.install")) {
    unlink_if_exists("/tmp/extensions_bhyve_config.php");
    $connected = @fsockopen("www.github.com", 80);
    if ($connected) {
        fclose($connected);
        unset($gitconfigfile);
        $gitconfigfile = file_get_contents("https://raw.githubusercontent.com/alexey1234/vmbhyve_nas4free/master/conf/ext/extensions_bhyve_config.php");
        $git_ver = preg_split("/bhyve_VERSION,/", $gitconfigfile);
        $git_ver = 0 + $git_ver[1];
        mwexec2("fetch -o /tmp/install.sh https://raw.githubusercontent.com/alexey1234/vmbhyve_nas4free/master/bhyve_install.sh", $garbage, $fetch_ret_val);
        if (is_file("/tmp/install.sh")) {
            // Fetch of install.sh succeeded
            mwexec("chmod a+x /tmp/install.sh");
        } else {
            $input_errors[] = "There seems to be a networking issue. I can't reach GitHub to retrieve the file. <br />Please check <a href='/system.php'>DNS</a> and other <a href='/interfaces_lan.php'>networking settings</a>. <br />Alternatively, try it again to see if there was some transient network problem.";
        }
        // end of failed install.sh fetch
    }
    // end of successful internet connectivity test
}
out:
include "fbegin.inc";
?>
<script type="text/javascript">//<![CDATA[
$(document).ready(function(){
开发者ID:alexey1234,项目名称:vmbhyve_nas4free,代码行数:31,代码来源:extensions_bhyve_config.php


示例16: mwexec2

 $cronjob['uuid'] = $_POST['uuid'];
 $cronjob['desc'] = $_POST['desc'];
 $cronjob['minute'] = !empty($_POST['minute']) ? $_POST['minute'] : null;
 $cronjob['hour'] = !empty($_POST['hour']) ? $_POST['hour'] : null;
 $cronjob['day'] = !empty($_POST['day']) ? $_POST['day'] : null;
 $cronjob['month'] = !empty($_POST['month']) ? $_POST['month'] : null;
 $cronjob['weekday'] = !empty($_POST['weekday']) ? $_POST['weekday'] : null;
 $cronjob['all_mins'] = $_POST['all_mins'];
 $cronjob['all_hours'] = $_POST['all_hours'];
 $cronjob['all_days'] = $_POST['all_days'];
 $cronjob['all_months'] = $_POST['all_months'];
 $cronjob['all_weekdays'] = $_POST['all_weekdays'];
 $cronjob['who'] = $_POST['who'];
 $cronjob['command'] = $_POST['command'];
 if (stristr($_POST['Submit'], gettext("Run now"))) {
     mwexec2(escapeshellcmd($_POST['command']), $output, $retval);
     if (0 == $retval) {
         $execmsg = gettext("The cron job has been executed successfully.");
         write_log("The cron job '{$_POST['command']}' has been executed successfully.");
     } else {
         $execfailmsg = gettext("Failed to execute cron job.");
         write_log("Failed to execute cron job '{$_POST['command']}'.");
     }
 } else {
     if (isset($uuid) && FALSE !== $cnid) {
         $a_cronjob[$cnid] = $cronjob;
         $mode = UPDATENOTIFY_MODE_MODIFIED;
     } else {
         $a_cronjob[] = $cronjob;
         $mode = UPDATENOTIFY_MODE_NEW;
     }
开发者ID:sdoney,项目名称:nas4free,代码行数:31,代码来源:system_cron_edit.php


示例17: mwexec2

        continue;
    }
    if (strpos($fname, '/') === false) {
        $zfs['pools']['pool'][$index]['used'] = $used;
        $zfs['pools']['pool'][$index]['avail'] = $avail;
    }
}
$rawdata = null;
$spa = @exec("sysctl -q -n vfs.zfs.version.spa");
if ($spa == '') {
    mwexec2("zpool list -H -o name,root,size,allocated,free,capacity,health", $rawdata);
} else {
    if ($spa < 21) {
        mwexec2("zpool list -H -o name,altroot,size,allocated,free,capacity,health", $rawdata);
    } else {
        mwexec2("zpool list -H -o name,altroot,size,allocated,free,capacity,health,dedup", $rawdata);
    }
}
foreach ($rawdata as $line) {
    if ($line == 'no pools available') {
        continue;
    }
    list($pool, $root, $size, $alloc, $free, $cap, $health, $dedup) = explode("\t", $line);
    if (false === ($index = array_search_ex($pool, $zfs['pools']['pool'], 'name'))) {
        continue;
    }
    if ($root != '-') {
        $zfs['pools']['pool'][$index]['root'] = $root;
    }
    $zfs['pools']['pool'][$index]['size'] = $size;
    $zfs['pools']['pool'][$index]['alloc'] = $alloc;
开发者ID:sdoney,项目名称:nas4free,代码行数:31,代码来源:disks_zfs_config_current.php


示例18: zfs_zpool_get_status

function zfs_zpool_get_status()
{
    global $config;
    array_sort_key($config['zfs']['pools']['pool'], "name");
    array_sort_key($config['zfs']['vdevices']['vdevice'], "name");
    $a_pool = $config['zfs']['pools']['pool'];
    $a_vdevice = $config['zfs']['vdevices']['vdevice'];
    // Get zpool status informations
    $cmd = "zpool status -v";
    if (isset($_GET['pool'])) {
        $cmd .= " {$_GET['pool']}";
    }
    mwexec2($cmd, $rawdata);
    // Modify and render status informations
    $result = "";
    foreach ($rawdata as $line) {
        if (preg_match("/(\\s+)(?:pool\\:)(\\s+)(.*)/", $line, $match)) {
            $pool = trim($match[3]);
            $index = array_search_ex($pool, $a_pool, "name");
            if (0 && $index !== false) {
                $href = "<a href='disks_zfs_zpool_edit.php?uuid={$a_pool[$index]['uuid']}'>{$pool}</a>";
                $result .= "{$match[1]}pool:{$match[2]}{$href}";
            } else {
                $result .= htmlspecialchars($line);
            }
        } else {
            if (preg_match("/(\\s+)(?:scrub\\:)(\\s+)(.*)/", $line, $match)) {
                if (0 && isset($pool)) {
                    $href = "<a href='disks_zfs_zpool_tools.php?action=scrub&option=s&pool={$pool}' title=\"" . sprintf(gettext("Start scrub on '%s'."), $pool) . "\">scrub</a>:";
                } else {
                    $href = "scrub";
                }
                $result .= "{$match[1]}{$href}{$match[2]}{$match[3]}";
            } else {
                if (0 && isset($pool)) {
                    $a_disk = get_conf_disks_filtered_ex("fstype", "zfs");
                    $found = false;
                    if (count($a_disk) > 0 && false !== ($index = array_search_ex($pool, $a_pool, "name"))) {
                        $pool_conf = $a_pool[$index];
                        if (is_array($pool_conf['vdevice'])) {
                            foreach ($pool_conf['vdevice'] as $vdevicev) {
                                if (false !== ($index = array_search_ex($vdevicev, $a_vdevice, "name"))) {
                                    $vdevice = $a_vdevice[$index];
                                    if (is_array($vdevice['device'])) {
                                        foreach ($vdevice['device'] as $devicev) {
                                            $index = array_search_ex($devicev, $a_disk, "devicespecialfile");
                                            if ($index === false) {
                                                continue 2;
                                            }
                                            $disk = $a_disk[$index];
                                            $string = "/(\\s+)(?:" . $disk['name'] . ")(\\s+)(\\w+)(.*)/";
                                            if (preg_match($string, $line, $match)) {
                                                $href = "<a href='disks_zfs_zpool_tools.php'>{$disk['name']}</a>";
                                                if (0 && $match[3] == "ONLINE") {
                                                    $href1 = "<a href='disks_zfs_zpool_tools.php?action=offline&option=d&pool={$pool}&device={$disk[name]}'>{$match[3]}</a>";
                                                } else {
                                                    if (0 && $match[3] == "OFFLINE") {
                                                        $href1 = "<a href='disks_zfs_zpool_tools.php?action=online&option=d&pool={$pool}&device={$disk[name]}'>{$match[3]}</a>";
                                                    } else {
                                                        $href1 = "";
                                                    }
                                                }
                                                $result .= "{$match[1]}{$href}{$match[2]}{$href1}{$match[4]}";
                                                $found = true;
                                                continue 2;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (!$found) {
                        $result .= htmlspecialchars($line);
                    }
                } else {
                    $result .= htmlspecialchars($line);
                }
            }
        }
        $result .= "<br />";
    }
    return $result;
}
开发者ID:ZenaVault,项目名称:FreeNAS-Source,代码行数:84,代码来源:disks_zfs_zpool_info.php


示例19: get_logmirror

function get_logmirror($pool, $dev)
{
    mwexec2("zpool status {$pool}", $rawdata);
    $type = "";
    $mirror = "";
    $dev = preg_replace('/^\\/dev\\//', "", $dev);
    foreach ($rawdata as $line) {
        if ($line[0] != "\t") {
            continue;
        }
        if (preg_match('/^\\t(\\S+)/', $line, $m)) {
            $mirror = "";
            if ($m[1] == "logs") {
                $type = "log";
            } else {
                $type = "";
            }
            continue;
        } else {
            if ($type != "log") {
                continue;
            }
        }
        if (preg_match('/^\\t(\\s+)(mirror-(\\S+))/', $line, $m)) {
            $mirror = $m[2];
        } else {
            if ($mirror == "") {
                continue;
            }
        }
        if (preg_match('/^\\t\\s+([a-z]+[0-9]+)/', $line, $dev)) {
            break;
        }
    }
    return $mirror;
}
开发者ID:sdoney,项目名称:nas4free,代码行数:36,代码来源:disks_zfs_zpool_tools.php


示例20: do_change

function do_change(&$pconfig)
{
    $address = $pconfig['media_uctladdress'];
    $port = $pconfig['media_uctlport'];
    $user = $pconfig['media_uctluser'];
    $secret = $pconfig['media_uctlsecret'];
    $muser = $pconfig['media_uctlmuser'];
    $msecret = $pconfig['media_uctlmsecret'];
    $target = $pconfig['target'];
    $lun = 0;
    $path = $pconfig['path'];
    $size = $pconfig['size'];
    $sizeunit = $pconfig['sizeunit'];
    $flags = $pconfig['flags'];
    $uctl = "/usr/local/bin/istgtcontrol";
    $args = "-q -c /var/etc/iscsi/istgtcontrol.conf";
    $args .= " -h " . escapeshellarg($address);
    $args .= " -p " . escapeshellarg($port);
    $args .= " -t " . escapeshellarg($target);
    $args .= " -l " . escapeshellarg($lun);
    $args .= " -U " . escapeshellarg($user);
    $args .= " -S " . escapeshellarg($secret);
    $args .= " -M " . escapeshellarg($muser);
    $args .= " -R " . escapeshellarg($msecret);
    $args .= " -s " . escapeshellarg("{$size}{$sizeunit}");
    $args .= " -f " . escapeshellarg($flags);
    $file = escapeshellarg($path);
    $cmd = "{$uctl} {$args} change {$file} 2>&1";
    unset($rawdata, $rc, $pconfig['error']);
    mwexec2($cmd, $rawdata, $rc);
    if ($rc != 0) {
        $pconfig['error'] = $rawdata[0];
        return -1;
    }
    return 0;
}
开发者ID:sdoney,项目名称:nas4free,代码行数:36,代码来源:services_iscsitarget_media.php



注:本文中的mwexec2函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mwexec_bg函数代码示例发布时间:2022-05-15
下一篇:
PHP mwexec函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap