当前位置: 首页>>代码示例>>PHP>>正文


PHP unix::DIRPART_INFO方法代码示例

本文整理汇总了PHP中unix::DIRPART_INFO方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::DIRPART_INFO方法的具体用法?PHP unix::DIRPART_INFO怎么用?PHP unix::DIRPART_INFO使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在unix的用法示例。


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

示例1: status_all_mysql_engines

function status_all_mysql_engines()
{
    $unix = new unix();
    if (systemMaxOverloaded()) {
        return;
    }
    $cachefile = "/usr/share/artica-postfix/ressources/logs/web/MYSQLDB_STATUS";
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
        }
        return;
    }
    @file_put_contents($pidfile, getmypid());
    if (!$GLOBALS["VERBOSE"]) {
        $time = $unix->file_time_min($cachefile);
        if ($time < 60) {
            return;
        }
    }
    $sock = new sockets();
    $datadir = $unix->MYSQL_DATA_DIR();
    $ArticaDBPath = $sock->GET_INFO("ArticaDBPath");
    if ($ArticaDBPath == null) {
        $ArticaDBPath = "/opt/articatech";
    }
    $SquidStatsDatabasePath = $sock->GET_INFO("SquidStatsDatabasePath");
    if ($SquidStatsDatabasePath == null) {
        $SquidStatsDatabasePath = "/opt/squidsql";
    }
    $array["APP_MYSQL_ARTICA"]["size"] = $unix->DIRSIZE_BYTES($datadir);
    $array["APP_MYSQL_ARTICA"]["INFO"] = $unix->DIRPART_INFO($datadir);
    if (is_dir("{$ArticaDBPath}/mysql")) {
        $array["APP_ARTICADB"]["size"] = $unix->DIRSIZE_BYTES("{$ArticaDBPath}");
        $array["APP_ARTICADB"]["INFO"] = $unix->DIRPART_INFO("{$ArticaDBPath}");
    }
    if (is_dir("{$SquidStatsDatabasePath}/data")) {
        $array["APP_SQUID_DB"]["size"] = $unix->DIRSIZE_BYTES("{$SquidStatsDatabasePath}");
        $array["APP_SQUID_DB"]["INFO"] = $unix->DIRPART_INFO("{$SquidStatsDatabasePath}");
    }
    $MySQLSyslogWorkDir = $sock->GET_INFO("MySQLSyslogWorkDir");
    if ($MySQLSyslogWorkDir == null) {
        $MySQLSyslogWorkDir = "/home/syslogsdb";
    }
    if (is_dir($MySQLSyslogWorkDir)) {
        $array["MYSQL_SYSLOG"]["size"] = $unix->DIRSIZE_BYTES($MySQLSyslogWorkDir);
        $array["MYSQL_SYSLOG"]["INFO"] = $unix->DIRPART_INFO($MySQLSyslogWorkDir);
    }
    if ($GLOBALS["VERBOSE"]) {
        print_r($array);
    }
    @unlink($cachefile);
    @file_put_contents($cachefile, base64_encode(serialize($array)));
    @chmod($cachefile, 0777);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:58,代码来源:exec.mysql.start.php

示例2: get_status

function get_status()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $TimeFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["OUTPUT"]) {
            echo "Restarting....: " . date("H:i:s") . " [INIT]: Already Artica task running PID {$pid} since {$time}mn\n";
        }
        return;
    }
    @file_put_contents($pidfile, getmypid());
    if ($GLOBALS["VERBOSE"]) {
        echo "TimeFile: {$TimeFile}\n";
    }
    if (!$GLOBALS["VERBOSE"]) {
        $zTime = $unix->file_time_min($TimeFile);
        if ($zTime < 10) {
            return;
        }
    }
    @unlink($TimeFile);
    @file_put_contents($TimeFile, time());
    $sock = new sockets();
    $StreamCacheCache = $sock->GET_INFO("StreamCacheCache");
    $StreamCacheMainCache = $sock->GET_INFO("StreamCacheMainCache");
    if ($StreamCacheCache == null) {
        $StreamCacheCache = "/home/squid/videocache";
    }
    if ($StreamCacheMainCache == null) {
        $StreamCacheMainCache = "/home/squid/streamcache";
    }
    $dir = $StreamCacheCache;
    if (is_link($dir)) {
        $dir = readlink($dir);
    }
    $Partition = $unix->DIRPART_INFO($dir);
    $SIZE = $unix->DIRSIZE_BYTES($dir);
    $array["VIDEOCACHE"]["SIZE"] = $SIZE;
    $array["VIDEOCACHE"]["PART"] = $Partition;
    $dir = $StreamCacheMainCache;
    if (is_link($dir)) {
        $dir = readlink($dir);
    }
    $Partition = $unix->DIRPART_INFO($dir);
    $SIZE = $unix->DIRSIZE_BYTES($dir);
    $array["SQUID"]["SIZE"] = $SIZE;
    $array["SQUID"]["PART"] = $Partition;
    @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/videocache.dirs.status.db", @serialize($array));
    @chmod("/usr/share/artica-postfix/ressources/logs/web/videocache.dirs.status.db", 0755);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:53,代码来源:exec.squidstream.php

示例3: InfluxDbSize

function InfluxDbSize()
{
    $dir = "/home/ArticaStatsDB";
    $unix = new unix();
    $size = $unix->DIRSIZE_KO($dir);
    $partition = $unix->DIRPART_INFO($dir);
    $TOT = $partition["TOT"];
    $percent = $size / $TOT * 100;
    $percent = round($percent, 3);
    if ($GLOBALS["VERBOSE"]) {
        echo "{$dir}: {$size} Partition {$TOT}\n";
    }
    $ARRAY["PERCENTAGE"] = $percent;
    $ARRAY["SIZEKB"] = $size;
    $ARRAY["PART"] = $TOT;
    if ($GLOBALS["VERBOSE"]) {
        print_r($ARRAY);
    }
    @unlink("/usr/share/artica-postfix/ressources/logs/web/InfluxDB.state");
    @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/InfluxDB.state", serialize($ARRAY));
}
开发者ID:articatech,项目名称:artica,代码行数:21,代码来源:exec.postgres.backup.php

示例4: caches_size

function caches_size()
{
    $unix = new unix();
    $cache_file = "/usr/share/artica-postfix/ressources/logs/web/squid_caches_center.db";
    if ($unix->file_time_min($cache_file) < 120) {
        return;
    }
    $q = new mysql();
    if ($q->COUNT_ROWS("squid_caches_center", "artica_backup") > 0) {
        $sql = "SELECT * FROM squid_caches_center WHERE `enabled`=1 AND `remove`=0 ORDER BY zOrder";
        $results = $q->QUERY_SQL($sql, "artica_backup");
        while ($ligne = mysql_fetch_assoc($results)) {
            $cachename = $ligne["cachename"];
            $cache_dir = $ligne["cache_dir"];
            $cache_type = $ligne["cache_type"];
            if ($cache_type == "Cachenull") {
                continue;
            }
            $cache_partition = $unix->DIRPART_OF($cache_dir);
            $ARRAY["CACHES_SIZE"][$cache_partition] = $unix->DIRECTORY_FREEM($cache_dir);
            $ARRAY[$cache_dir]["NAME"] = $cachename;
            $ARRAY[$cache_dir]["PARTITION"] = $cache_partition;
            $ARRAY[$cache_dir]["DIRPART_INFO"] = $unix->DIRPART_INFO($cache_dir);
            $ARRAY[$cache_dir]["SIZE"] = $ARRAY["CACHES_SIZE"][$cache_partition];
            $ARRAY[$cache_dir]["DIRSIZE_MB"] = $unix->DIRSIZE_MB($cache_dir);
        }
    }
    $caches = $unix->SQUID_CACHE_FROM_SQUIDCONF_FULL();
    while (list($cache_dir, $line) = each($caches)) {
        if (isset($ARRAY[$cache_dir])) {
            continue;
        }
        $cachename = basename($cache_dir);
        $cache_partition = $unix->DIRPART_OF($cache_dir);
        $ARRAY["CACHES_SIZE"][$cache_partition] = $unix->DIRECTORY_FREEM($cache_dir);
        $ARRAY[$cache_dir]["NAME"] = $cachename;
        $ARRAY[$cache_dir]["PARTITION"] = $cache_partition;
        $ARRAY[$cache_dir]["DIRPART_INFO"] = $unix->DIRPART_INFO($cache_dir);
        $ARRAY[$cache_dir]["SIZE"] = $GLOBALS["CACHES_SIZE"][$cache_partition];
        $ARRAY[$cache_dir]["DIRSIZE_MB"] = $unix->DIRSIZE_MB($cache_dir);
    }
    print_r($ARRAY);
    @unlink($cache_file);
    @file_put_contents($cache_file, serialize($ARRAY));
    @chmod($cache_file, 0777);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:46,代码来源:exec.squid.watchdog.php

示例5: DirectorySize

function DirectorySize()
{
    if (!isset($GLOBALS["WindowsUpdateCachingDir"])) {
        $GLOBALS["WindowsUpdateCachingDir"] = @file_get_contents("/etc/artica-postfix/settings/Daemons/WindowsUpdateCachingDir");
        if ($GLOBALS["WindowsUpdateCachingDir"] == null) {
            $GLOBALS["WindowsUpdateCachingDir"] = "/home/squid/WindowsUpdate";
        }
    }
    $dir = $GLOBALS["WindowsUpdateCachingDir"];
    $unix = new unix();
    $time = $unix->file_time_min("/usr/share/artica-postfix/ressources/logs/web/WindowsUpdate.state");
    if ($time < 120) {
        return;
    }
    $size = $unix->DIRSIZE_KO_nocache($dir);
    $partition = $unix->DIRPART_INFO($dir);
    print_r($partition);
    $TOT = $partition["TOT"];
    $AIV = $partition["AIV"];
    $percent = $size / $TOT * 100;
    $percent = round($percent, 3);
    events("INFO: Storage {$size} Partition {$TOT}", __LINE__);
    $ARRAY["PERCENTAGE"] = $percent;
    $ARRAY["SIZEKB"] = $size;
    $ARRAY["PART"] = $TOT;
    $ARRAY["AIV"] = $AIV;
    @unlink("/usr/share/artica-postfix/ressources/logs/web/WindowsUpdate.state");
    @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/WindowsUpdate.state", serialize($ARRAY));
}
开发者ID:articatech,项目名称:artica,代码行数:29,代码来源:exec.windowsupdate-partials.php

示例6: BackupLogsMaxStoragePercent_info

function BackupLogsMaxStoragePercent_info()
{
    $BackupMaxDaysDir = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/BackupMaxDaysDir"));
    if ($BackupMaxDaysDir == null) {
        $BackupMaxDaysDir = "/home/logrotate_backup";
    }
    if (!is_dir("{$BackupMaxDaysDir}")) {
        @mkdir("{$BackupMaxDaysDir}", true);
    }
    $unix = new unix();
    $DIRPART_INFO = $unix->DIRPART_INFO($BackupMaxDaysDir);
    $DIRSIZE = $unix->DIRSIZE_BYTES($BackupMaxDaysDir);
    $DIRPART_INFO["CURSIZE"] = $DIRSIZE;
    echo "<articadatascgi>" . base64_encode(serialize($DIRPART_INFO)) . "</articadatascgi>";
}
开发者ID:articatech,项目名称:artica,代码行数:15,代码来源:system.php

示例7: xscan

function xscan()
{
    $ARRAY = array();
    $sock = new sockets();
    $unix = new unix();
    $Pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $PidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    // /etc/artica-postfix/pids/exec.clean.logs.php.squidClean.time
    if ($GLOBALS["VERBOSE"]) {
        echo "Pidfile: {$Pidfile}\n";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "PidTime: {$PidTime}\n";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "Memory Free: " . $unix->TOTAL_MEMORY_MB_FREE() . "/" . $unix->TOTAL_MEMORY_MB() . "\n";
        echo "Memory Use: " . $unix->TOTAL_MEMORY_MB_USED() . " - " . $unix->TOTAL_MEM_POURCENT_USED() . "%\n";
    }
    $pid = $unix->get_pid_from_file($Pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Aborting Task already running pid {$pid} " . __FUNCTION__ . "()\n";
        }
        return;
    }
    if (!$GLOBALS["FORCE"]) {
        $TimeExec = $unix->file_time_min($PidTime);
        if ($TimeExec < 20) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Aborting Task {$TimeExec}mn, require 20mn " . __FUNCTION__ . "()\n";
            }
            return;
        }
    }
    @unlink($PidTime);
    @file_put_contents($PidTime, time());
    @file_put_contents($Pidfile, getmypid());
    xscan2();
    $q = new mysql_storelogs();
    $LogRotatePath = $sock->GET_INFO("LogRotatePath");
    $SystemLogsPath = $sock->GET_INFO("SystemLogsPath");
    $BackupMaxDays = intval($sock->GET_INFO("BackupMaxDays"));
    $BackupMaxDaysDir = $sock->GET_INFO("BackupMaxDaysDir");
    if ($BackupMaxDaysDir == null) {
        $BackupMaxDaysDir = "/home/logrotate_backup";
    }
    if (!is_dir("{$BackupMaxDaysDir}")) {
        @mkdir("{$BackupMaxDaysDir}", true);
    }
    if ($BackupMaxDays == 0) {
        $BackupMaxDays = 30;
    }
    $BackupLogsMaxStoragePercent = intval($sock->GET_INFO("BackupLogsMaxStoragePercent"));
    if ($BackupLogsMaxStoragePercent == 0) {
        $BackupLogsMaxStoragePercent = 50;
    }
    $BackupMaxDaysMins = $BackupMaxDays * 1440;
    echo "Max TTL : {$BackupMaxDaysMins} Minutes\n";
    $files = $unix->DirFiles($BackupMaxDaysDir);
    while (list($filepath, $none) = each($files)) {
        $filename = "{$BackupMaxDaysDir}/{$filepath}";
        $filetime = $unix->file_time_min($filename);
        echo "{$filepath} = {$filetime}/{$BackupMaxDaysMins}\n";
        if ($filetime > $BackupMaxDaysMins) {
            rotate_admin_events("Removed {$filepath} {$filetime}mn, exceed {$BackupMaxDays} days", __FUNCTION__, __FILE__, __LINE__);
            @unlink($filename);
            continue;
        }
        $filesecs = filemtime($filename);
        $ARRAY[$filesecs] = $filepath;
    }
    $DIRPART_INFO = $unix->DIRPART_INFO($BackupMaxDaysDir);
    $TOTAL_PART = $DIRPART_INFO["TOT"];
    $percent = $BackupLogsMaxStoragePercent / 100;
    $TOTAL_AVAILABLE = $TOTAL_PART * $percent;
    $DIRSIZE = $unix->DIRSIZE_BYTES($BackupMaxDaysDir);
    $TOTAL_PART = $DIRPART_INFO["TOT"] / 1024;
    $q->events("Directory size = {$DIRSIZE}/{$TOTAL_AVAILABLE} " . FormatBytes($DIRSIZE / 1024, true) . "/" . FormatBytes($TOTAL_AVAILABLE / 1024, true), __FUNCTION__, __LINE__);
    if ($DIRSIZE > $TOTAL_AVAILABLE) {
        CleanPercent($BackupMaxDaysDir, $TOTAL_AVAILABLE);
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:82,代码来源:exec.clean-logs-backup.php

示例8: CheckPartitionPercentage

function CheckPartitionPercentage()
{
    if (!isset($GLOBALS["WindowsUpdateCachingDir"])) {
        $GLOBALS["WindowsUpdateCachingDir"] = @file_get_contents("/etc/artica-postfix/settings/Daemons/WindowsUpdateCachingDir");
        if ($GLOBALS["WindowsUpdateCachingDir"] == null) {
            $GLOBALS["WindowsUpdateCachingDir"] = "/home/squid/WindowsUpdate";
        }
    }
    $dir = $GLOBALS["WindowsUpdateCachingDir"];
    $unix = new unix();
    $partition = $unix->DIRPART_INFO($dir);
    return $partition["POURC"];
}
开发者ID:articatech,项目名称:artica,代码行数:13,代码来源:exec.windowsupdate.php

示例9: DirectorySize

function DirectorySize()
{
    $unix = new unix();
    $pid_path = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__;
    $timePath = "/etc/artica-postfix/croned.1/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pid = @file_get_contents($pid_path);
    if (!$GLOBALS["FORCE"]) {
        if ($unix->process_exists($pid)) {
            die;
        }
        $childpid = posix_getpid();
        @file_put_contents($pid_path, $childpid);
        if (system_is_overloaded()) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Overloaded system.\n";
            }
            return;
        }
    }
    $filetim = $unix->file_time_min($timePath);
    if ($GLOBALS["VERBOSE"]) {
        echo "Time File: {$timePath} ({$filetim}Mn)\n";
    }
    if (!$GLOBALS["FORCE"]) {
        if ($filetim < 240) {
            return;
        }
    }
    $partition_default = $unix->IMAPD_GET("partition-default");
    if (is_link($partition_default)) {
        $partition_default = readlink($partition_default);
    }
    @file_put_contents($timePath, time());
    if ($GLOBALS["VERBOSE"]) {
        echo "partition_default = {$partition_default}\n";
    }
    artica_mysql_events("Starting calculate - {$partition_default} - disk size", null, __FILE__, "mailbox");
    if (strlen($partition_default) < 3) {
        return;
    }
    if (!is_dir($partition_default)) {
        return;
    }
    $currentsize = $unix->DIRSIZE_BYTES($partition_default) / 1024 / 1024;
    $PartInfo = $unix->DIRPART_INFO($partition_default);
    $totalMB = $PartInfo["TOT"];
    $totalMB = round($totalMB / 1048576);
    if ($GLOBALS["VERBOSE"]) {
        echo "partition_default = {$currentsize}MB/{$totalMB}MB\n";
    }
    $sock = new sockets();
    $currentsize = round($currentsize);
    $sock->SET_INFO("CyrusImapPartitionDefaultSize", $currentsize);
    $sock->SET_INFO("CyrusImapPartitionDefaultSizeTime", time());
    $sock->SET_INFO("CyrusImapPartitionDiskSize", $totalMB);
    send_email_events("Mailboxes size on your server: {$currentsize} MB", "Mailboxes size on your server: {$currentsize} MB", "mailbox");
    if ($partition_default == "/var/spool/cyrus/mail") {
        $sock->SET_INFO("CyrusImapPartitionDefaultDirSize", $currentsize);
        return;
    }
    $currentsize = $unix->DIRSIZE_BYTES("/var/spool/cyrus/mail") / 1024 / 1024;
    $sock->SET_INFO("CyrusImapPartitionDefaultDirSize", $currentsize);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:63,代码来源:exec.cyrus.php


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