コード例 #1
0
function FillMemory()
{
    $unix = new unix();
    $GLOBALS["TIME"] = unserialize(@file_get_contents("/etc/artica-postfix/pids/" . basename(__FILE__) . ".GLOBALS"));
    if (GET_INFO_DAEMON("cpuLimitEnabled") == 1) {
        $GLOBALS["cpuLimitEnabled"] = true;
    } else {
        $GLOBALS["cpuLimitEnabled"] = false;
    }
    $_GET["NICE"] = $unix->EXEC_NICE();
    $GLOBALS["EXEC_NICE"] = $_GET["NICE"];
    $GLOBALS["PHP5"] = $unix->LOCATE_PHP5_BIN();
    $GLOBALS["SU"] = $unix->find_program("su");
    $users = new settings_inc();
    $sock = new sockets();
    $DisableArticaStatusService = $sock->GET_INFO("DisableArticaStatusService");
    $EnableArticaExecutor = $sock->GET_INFO("EnableArticaExecutor");
    if (!is_numeric($DisableArticaStatusService)) {
        $DisableArticaStatusService = 0;
    }
    if (!is_numeric($EnableArticaExecutor)) {
        $EnableArticaExecutor = 1;
    }
    $GLOBALS["KAV4PROXY_INSTALLED"] = false;
    $GLOBALS["SPAMASSASSIN_INSTALLED"] = $users->spamassassin_installed;
    $GLOBALS["ARTICA_STATUS_DISABLED"] = $DisableArticaStatusService;
    $GLOBALS["EXECUTOR_DAEMON_ENABLED"] = $EnableArticaExecutor;
    $GLOBALS["SQUID_INSTALLED"] = $users->SQUID_INSTALLED;
    $GLOBALS["KAV4PROXY_INSTALLED"] = $users->KAV4PROXY_INSTALLED;
    $GLOBALS["MILTER_GREYLIST_INSTALLED"] = $users->MILTERGREYLIST_INSTALLED;
    $GLOBALS["POSTFIX_INSTALLED"] = $users->POSTFIX_INSTALLED;
    $GLOBALS["SAMBA_INSTALLED"] = $users->SAMBA_INSTALLED;
    $GLOBALS["GREYHOLE_INSTALLED"] = $users->GREYHOLE_INSTALLED;
    $GLOBALS["MUNIN_CLIENT_INSTALLED"] = $users->SAMBA_INSTALLED;
    $GLOBALS["CYRUS_IMAP_INSTALLED"] = $users->cyrus_imapd_installed;
    $_GET["MIME_DEFANGINSTALLED"] = $users->MIMEDEFANG_INSTALLED;
    $GLOBALS["DANSGUARDIAN_INSTALLED"] = $users->DANSGUARDIAN_INSTALLED;
    $GLOBALS["OPENVPN_INSTALLED"] = $users->OPENVPN_INSTALLED;
    $GLOBALS["OCS_INSTALLED"] = $users->OCSI_INSTALLED;
    $GLOBALS["UFDBGUARD_INSTALLED"] = $users->APP_UFDBGUARD_INSTALLED;
    $GLOBALS["KAS_INSTALLED"] = $users->kas_installed;
    $GLOBALS["ZARAFA_INSTALLED"] = $users->ZARAFA_INSTALLED;
    $GLOBALS["XAPIAN_PHP_INSTALLED"] = $users->XAPIAN_PHP_INSTALLED;
    $GLOBALS["AUDITD_INSTALLED"] = $users->APP_AUDITD_INSTALLED;
    $GLOBALS["VIRTUALBOX_INSTALLED"] = $users->VIRTUALBOX_INSTALLED;
    $GLOBALS["DRUPAL7_INSTALLED"] = $users->DRUPAL7_INSTALLED;
    $GLOBALS["CGROUPS_INSTALLED"] = $users->CGROUPS_INSTALLED;
    if ($GLOBALS["VERBOSE"]) {
        writelogs("DANSGUARDIAN_INSTALLED={$GLOBALS["DANSGUARDIAN_INSTALLED"]}", "MAIN", __FILE__, __LINE__);
    }
    $GLOBALS["EnableArticaWatchDog"] = GET_INFO_DAEMON("EnableArticaWatchDog");
    if ($GLOBALS["VERBOSE"]) {
        if ($GLOBALS["POSTFIX_INSTALLED"]) {
            events("Postfix is installed...");
        }
    }
    if ($GLOBALS["VERBOSE"]) {
        events("Nice=\"\", php5 {$GLOBALS["PHP5"]}");
    }
    $GLOBALS["EnableInterfaceMailCampaigns"] = $sock->GET_INFO("EnableInterfaceMailCampaigns");
    $GLOBALS["CLASS_SOCKETS"] = $sock;
    $GLOBALS["TOTAL_MEMORY_MB"] = $unix->TOTAL_MEMORY_MB();
    if (!$GLOBALS["KAV4PROXY_INSTALLED"]) {
        if (is_file("/etc/artica-postfix/KASPERSKY_WEB_APPLIANCE")) {
            $GLOBALS["KAV4PROXY_INSTALLED"] = true;
        }
    }
    $sock = null;
    $unix = null;
    $users = null;
}
コード例 #2
0
ファイル: services.php プロジェクト: brucewu16899/1.6.x
function total_memory()
{
    $unix = new unix();
    $mem = $unix->TOTAL_MEMORY_MB();
    writelogs_framework("TOTAL_MEMORY_MB: {$mem}", __FUNCTION__, __FILE__, __LINE__);
    echo "<articadatascgi>{$mem}</articadatascgi>";
}
コード例 #3
0
function Watch()
{
    $unix = new unix();
    //
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "Time: {$pidTime}\n";
    }
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Already executed pid {$pid}\n";
        }
        return;
    }
    $sock = new sockets();
    $SwapOffOn = unserialize(base64_decode($sock->GET_INFO("SwapOffOn")));
    if (!is_numeric($SwapOffOn["AutoMemWatchdog"])) {
        $SwapOffOn["AutoMemWatchdog"] = 1;
    }
    if (!is_numeric($SwapOffOn["AutoMemPerc"])) {
        $SwapOffOn["AutoMemPerc"] = 90;
    }
    if (!is_numeric($SwapOffOn["AutoMemInterval"])) {
        $SwapOffOn["AutoMemInterval"] = 180;
    }
    if ($SwapOffOn["AutoMemWatchdog"] == 0) {
        return;
    }
    if (!$GLOBALS["VERBOSE"]) {
        $timefile = $unix->file_time_min($pidTime);
        if ($timefile < $SwapOffOn["AutoMemInterval"]) {
            return;
        }
    }
    @unlink($pidTime);
    @file_put_contents($pidTime, time());
    $TOTAL_MEMORY_MB_FREE = $unix->TOTAL_MEMORY_MB_FREE();
    $TOTAL_MEM_POURCENT_USED = $unix->TOTAL_MEM_POURCENT_USED();
    $TOTAL_MEMORY = $unix->TOTAL_MEMORY_MB();
    $SwapOffOn["CURRENT"] = "Before operation: Server memory {$TOTAL_MEMORY}MB {$TOTAL_MEMORY_MB_FREE}Mb Free used {$TOTAL_MEM_POURCENT_USED}%";
    if ($GLOBALS["VERBOSE"]) {
        echo "TOTAL_MEM_POURCENT_USED = {$TOTAL_MEM_POURCENT_USED} / {$SwapOffOn["AutoMemPerc"]}% FREE: {$TOTAL_MEMORY_MB_FREE}MB\n";
    }
    if ($TOTAL_MEM_POURCENT_USED > $SwapOffOn["AutoMemPerc"]) {
        FreeMem(true, $SwapOffOn);
    }
}
コード例 #4
0
    echo "Starting......: " . date("H:i:s") . " artica-background Already executed pid {$pid}\n";
    die;
}
if ($argv[1] == "--manual") {
    FillMemory();
    die;
}
$sock = new sockets();
$EnableArticaBackground = $sock->GET_INFO("EnableArticaBackground");
if (!is_numeric($EnableArticaBackground)) {
    $EnableArticaBackground = 1;
}
if ($EnableArticaBackground == 0) {
    die;
}
$GLOBALS["TOTAL_MEMORY_MB"] = $unix->TOTAL_MEMORY_MB();
if ($GLOBALS["TOTAL_MEMORY_MB"] < 400) {
    $pid = @file_get_contents($GLOBALS["EXEC_PID_FILE"]);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        events("Process Already exist pid {$pid}");
        die;
    }
    $childpid = posix_getpid();
    echo "Starting......: " . date("H:i:s") . " artica-background lower config, remove fork\n";
    @file_put_contents($GLOBALS["EXEC_PID_FILE"], $childpid);
    FillMemory();
    $renice_bin = $GLOBALS["CLASS_UNIX"]->find_program("renice");
    events("{$renice_bin} 19 {$childpid}", __FUNCTION__, __LINE__);
    shell_exec('export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11 &');
    shell_exec("{$renice_bin} 19 {$childpid} &");
    events("Started pid {$childpid}", __FUNCTION__, __LINE__);
コード例 #5
0
function postfix_mem_disk_status()
{
    $hostname = $_GET["postfix-mem-disk-status"];
    if ($hostname == "master") {
        $directory = "/var/spool/postfix";
    } else {
        $directory = "/var/spool/postfix-{$hostname}";
    }
    $unix = new unix();
    $mem = $unix->MOUNTED_TMPFS_MEM($directory);
    $TOTAL_MEMORY_MB = $unix->TOTAL_MEMORY_MB();
    $TOTAL_MEMORY_MB_FREE = $unix->TOTAL_MEMORY_MB_USED();
    $array = array("MOUTED" => $mem, "TOTAL_MEMORY_MB" => $TOTAL_MEMORY_MB, "TOTAL_MEMORY_MB_FREE" => $TOTAL_MEMORY_MB_FREE);
    echo "<articadatascgi>" . base64_encode(serialize($array)) . "</articadatascgi>";
}
コード例 #6
0
function total_memory()
{
    $unix = new unix();
    echo "<articadatascgi>" . $unix->TOTAL_MEMORY_MB() . "</articadatascgi>";
}
コード例 #7
0
ファイル: exec.squidguard.php プロジェクト: BillTheBest/1.6.x
function ufdbdatabases_in_mem()
{
    $sock = new sockets();
    $unix = new unix();
    $UfdbDatabasesInMemory = $sock->GET_INFO("UfdbDatabasesInMemory");
    if (!is_numeric($UfdbDatabasesInMemory)) {
        $UfdbDatabasesInMemory = 0;
    }
    if ($UfdbDatabasesInMemory == 0) {
        echo "Starting URLfilterDB Database in memory feature is disabled\n";
        $MOUNTED_DIR_MEM = $unix->MOUNTED_TMPFS_MEM("/var/lib/ufdbguard-memory");
        if ($MOUNTED_DIR_MEM > 0) {
            echo "Starting URLfilterDB Database unmounting...\n";
            $umount = $unix->find_program("umount");
            shell_exec("{$umount} -l /var/lib/ufdbguard-memory");
        }
        return;
    }
    $POSSIBLEDIRS[] = "/var/lib/ufdbartica";
    $POSSIBLEDIRS[] = "/var/lib/squidguard";
    $POSSIBLEDIRS[] = "/var/lib/ftpunivtlse1fr";
    $ufdbartica_size = $unix->DIRSIZE_BYTES("/var/lib/ufdbartica");
    $ufdbartica_size = round($ufdbartica_size / 1024 / 1000) + 5;
    $squidguard_size = $unix->DIRSIZE_BYTES("/var/lib/squidguard");
    $squidguard_size = round($squidguard_size / 1024 / 1000) + 5;
    $ftpunivtlse1fr_size = $unix->DIRSIZE_BYTES("/var/lib/ftpunivtlse1fr");
    $ftpunivtlse1fr_size = round($ftpunivtlse1fr_size / 1024 / 1000) + 5;
    echo "Starting URLfilterDB ufdbartica DB....: about {$ufdbartica_size}MB\n";
    echo "Starting URLfilterDB squidguard DB....: about {$squidguard_size}MB\n";
    echo "Starting URLfilterDB ftpunivtlse1fr DB: about {$ftpunivtlse1fr_size}MB\n";
    $total = $ufdbartica_size + $squidguard_size + $ftpunivtlse1fr_size + 10;
    echo "Starting URLfilterDB require {$total}MB\n";
    $mount = $unix->find_program("mount");
    $MOUNTED_DIR_MEM = $unix->MOUNTED_TMPFS_MEM("/var/lib/ufdbguard-memory");
    if ($MOUNTED_DIR_MEM == 0) {
        $system_mem = $unix->TOTAL_MEMORY_MB();
        echo "Starting URLfilterDB system memory {$system_mem}MB\n";
        if ($system_mem < $total) {
            $require = $total - $system_mem;
            echo "Starting URLfilterDB not engough memory require at least {$require}MB\n";
            return;
        }
        $system_free = $unix->TOTAL_MEMORY_MB_FREE();
        echo "Starting URLfilterDB system memory available {$system_free}MB\n";
        if ($system_free < $total) {
            $require = $total - $system_free;
            echo "Starting URLfilterDB not engough memory require at least {$require}MB\n";
            return;
        }
    }
    $idbin = $unix->find_program("id");
    $mount = $unix->find_program("mount");
    $umount = $unix->find_program("umount");
    $rm = $unix->find_program("rm");
    $cp = $unix->find_program("cp");
    $chown = $unix->find_program("chown");
    if ($MOUNTED_DIR_MEM > 0) {
        if ($MOUNTED_DIR_MEM < $total) {
            echo "Starting URLfilterDB: umounting from memory\n";
            shell_exec("{$umount} -l /var/lib/ufdbguard-memory");
            $MOUNTED_DIR_MEM = $unix->MOUNTED_TMPFS_MEM("/var/lib/ufdbguard-memory");
        }
    }
    if ($MOUNTED_DIR_MEM == 0) {
        if (strlen($idbin) < 3) {
            echo "Starting URLfilterDB: tmpfs `id` no such binary\n";
            return;
        }
        if (strlen($mount) < 3) {
            echo "Starting URLfilterDB: tmpfs `mount` no such binary\n";
            return;
        }
        exec("{$idbin} squid 2>&1", $results);
        if (!preg_match("#uid=([0-9]+).*?gid=([0-9]+)#", @implode("", $results), $re)) {
            echo "Starting......: " . date("H:i:s") . "MySQL mysql no such user...\n";
            return;
        }
        $uid = $re[1];
        $gid = $re[2];
        echo "Starting URLfilterDB: tmpfs uid/gid ={$uid}:{$gid} for {$total}M\n";
        @mkdir("/var/lib/ufdbguard-memory");
        $cmd = "{$mount} -t tmpfs -o rw,uid={$uid},gid={$gid},size={$total}M,nr_inodes=10k,mode=0700 tmpfs \"/var/lib/ufdbguard-memory\"";
        shell_exec($cmd);
        $MOUNTED_DIR_MEM = $unix->MOUNTED_TMPFS_MEM("/var/lib/ufdbguard-memory");
        if ($MOUNTED_DIR_MEM == 0) {
            echo "Starting URLfilterDB: tmpfs failed...\n";
            return;
        }
    }
    echo "Starting URLfilterDB: mounted as {$MOUNTED_DIR_MEM}MB\n";
    reset($POSSIBLEDIRS);
    while (list($index, $directory) = each($POSSIBLEDIRS)) {
        $directoryname = basename($directory);
        @mkdir("/var/lib/ufdbguard-memory/{$directoryname}", 0755, true);
        if (!is_dir("/var/lib/ufdbguard-memory/{$directoryname}")) {
            echo "Starting URLfilterDB: {$directoryname} permission denied\n";
            return;
        }
        @chown("/var/lib/ufdbguard-memory/{$directoryname}", "squid");
        echo "Starting URLfilterDB: replicating {$directoryname}\n";
        shell_exec("{$cp} -rfu {$directory}/* /var/lib/ufdbguard-memory/{$directoryname}/");
    }
    $ufdbguardConfs[] = "/etc/ufdbguard/ufdbGuard.conf";
    $ufdbguardConfs[] = "/etc/squid3/ufdbGuard.conf";
    echo "Starting URLfilterDB: setup privileges\n";
    shell_exec("{$chown} -R squid:squid /var/lib/ufdbguard-memory >/dev/null 2>&1");
    echo "Starting URLfilterDB: modify configuration files\n";
    while (list($index, $configfile) = each($ufdbguardConfs)) {
        $f = explode("\n", @file_get_contents($configfile));
        while (list($indexLine, $line) = each($f)) {
            reset($POSSIBLEDIRS);
            while (list($index, $directory) = each($POSSIBLEDIRS)) {
                $directoryname = basename($directory);
                $line = str_replace($directory, "/var/lib/ufdbguard-memory/{$directoryname}", $line);
                $f[$indexLine] = $line;
            }
        }
        @file_put_contents($configfile, @implode("\n", $f));
        echo "Starting URLfilterDB: {$configfile} success...\n";
    }
}
コード例 #8
0
        $MysqlConfigLevel = -1;
    }
}
if ($MysqlConfigLevel > 0) {
    if ($MysqlConfigLevel == 1) {
        echo "Starting......:Mysql my.cnf........: SWITCH TO LOWER CONFIG.\n";
        $datas = $q->Mysql_low_config();
    }
    if ($MysqlConfigLevel == 2) {
        echo "Starting......:Mysql my.cnf........: SWITCH TO VERY LOWER CONFIG.\n";
        $datas = $q->Mysql_verlow_config();
    }
}
if ($MysqlConfigLevel == 0) {
    $unix = new unix();
    $mem = $unix->TOTAL_MEMORY_MB();
    echo "\n";
    echo "Starting......: Mysql my.cnf........: Total memory {$mem}MB\n";
    if ($mem < 550) {
        echo "Starting......:Mysql my.cnf........: SWITCH TO LOWER CONFIG.\n";
        $datas = $q->Mysql_low_config();
        if ($mem < 390) {
            echo "Starting......:Mysql my.cnf........: SWITCH TO VERY LOWER CONFIG.\n";
            $datas = $q->Mysql_verlow_config();
        }
    } else {
        $datas = $q->BuildConf();
    }
}
if ($MysqlConfigLevel == -1) {
    echo "Starting......: Mysql my.cnf........: SWITCH TO PERSONALIZED CONFIG.\n";
コード例 #9
0
include_once dirname(__FILE__) . '/ressources/class.users.menus.inc';
include_once dirname(__FILE__) . '/framework/class.unix.inc';
include_once dirname(__FILE__) . '/framework/frame.class.inc';
include_once dirname(__FILE__) . "/ressources/class.ccurl.inc";
$sock = new sockets();
$unix = new unix();
$chmod = $unix->find_program("chmod");
$LinuxDistributionFullName = $sock->GET_INFO("LinuxDistributionFullName");
if ($LinuxDistributionFullName == null) {
    $LinuxDistributionFullName = "Linux default";
}
$users = new usersMenus();
shell_exec($unix->LOCATE_PHP5_BIN() . " /usr/share/artica-postfix/exec.dmidecode.php --chassis --force");
$datas = trim(@file_get_contents("/etc/artica-postfix/dmidecode.cache.url"));
$SYSTEMID = $sock->GET_INFO("SYSTEMID");
$MEMORY_INSTALLED = $unix->TOTAL_MEMORY_MB();
$SystemCpuNumber = $sock->GET_INFO("SystemCpuNumber");
$ARTICA_VERSION = @file_get_contents("/usr/share/artica-postfix/VERSION");
$hostname = $users->hostname;
$UsersNumber = @file_get_contents("/etc/artica-postfix/UsersNumber");
if (!is_numeric($UsersNumber)) {
    $UsersNumber = 0;
}
$uriplus = "{$SYSTEMID};{$MEMORY_INSTALLED};{$SystemCpuNumber};{$LinuxDistributionFullName};{$ARTICA_VERSION};{$hostname};{$UsersNumber};{$datas}";
$uriplus = str_replace(" ", "%20", $uriplus);
$ini = new Bs_IniHandler();
$ini->loadFile("/etc/artica-postfix/artica-update.conf");
$uri = $ini->get("AUTOUPDATE", "uri");
if (trim($uri) == null) {
    $uri = "http://93.88.245.88/auto.update.php";
}
コード例 #10
0
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);
    }
}
コード例 #11
0
function squid_frontend()
{
    $sock = new sockets();
    $page = CurrentPageName();
    $SQUIDEnable = $sock->GET_INFO("SQUIDEnable");
    if (!is_numeric($SQUIDEnable)) {
        $SQUIDEnable = 1;
    }
    $SquidPerformance = intval($sock->GET_INFO("SquidPerformance"));
    $AsSeenPerformanceFeature = intval($sock->GET_INFO("AsSeenPerformanceFeature"));
    $SquidPerformanceRemoveNotice = intval($sock->GET_INFO("SquidPerformanceRemoveNotice"));
    if ($SQUIDEnable == 0) {
        return;
    }
    if ($SquidPerformance < 2) {
        $addon = "<div id='squid-rttrqs-status'></div>";
    }
    $addonUfdBcat = "OnMouseOver=\"this.style.cursor='pointer'\"  OnMouseOut=\"this.style.cursor='default';\" OnClick=\"javascript:AnimateDiv('BodyContent');LoadAjax('BodyContent','squid.global.performance.php')\"";
    if ($AsSeenPerformanceFeature == 0) {
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body("<div class='explain' style='padding:5px;font-size:18px;' {$addonUfdBcat} >{SquidAsSeenPerformanceFeature}</div>");
    }
    if ($SquidPerformance == 0) {
        if ($SquidPerformanceRemoveNotice == 0) {
            if ($GLOBALS["AS_ROOT"]) {
                $unix = new unix();
                $MEMORY = $unix->TOTAL_MEMORY_MB();
            } else {
                $MEMORY = intval($sock->getFrameWork("cmd.php?GetTotalMemMB=yes"));
            }
            if ($MEMORY > 5) {
                if ($MEMORY < 4500) {
                    echo "<div id='error-squid-memory-notice'>" . FATAL_ERROR_SHOW_128("\n\t\t\t\t<strong style='font-size:22px'>{$MEMORY}MB/5900MB</strong>\n\t\t\t\t<hr>\n\t\t\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:AnimateDiv('BodyContent');LoadAjax('BodyContent','squid.global.performance.php')\">{server_did_not_have_enough_memory_ufdbcat}</a>\n\t\t\t\t<div style='text-align:right;margin-top:10px'><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('{$page}?remove-performance-alert=yes');\" style='text-decoration:underline'>{remove_this_notice}</a></div>\n\t\t\t\t") . "</div>";
                }
            }
        }
    }
    if ($GLOBALS["AS_ROOT"]) {
        $unix = new unix();
        $unix->SQUID_ACTIVE_REQUESTS();
    } else {
        $sock->getFrameWork("squid.php?active-requests=yes");
    }
    $page = CurrentPageName();
    echo "\n\t<div id='squid-front-end-status'></div>\n\t{$addon}\n\t\t<script>LoadAjaxTiny('squid-front-end-status','{$page}?squid-front-end-status=yes');\n\t</script>";
}
コード例 #12
0
ファイル: exec.executor.php プロジェクト: rsd/artica-1.5
function FillMemory(){
	$unix=new unix();
	$GLOBALS["TIME"]=unserialize(@file_get_contents("/etc/artica-postfix/pids/".basename(__FILE__).".GLOBALS"));
	
	
	if(GET_INFO_DAEMON("cpuLimitEnabled")==1){$GLOBALS["cpuLimitEnabled"]=true;}else{$GLOBALS["cpuLimitEnabled"]=false;}
	$_GET["NICE"]=$unix->EXEC_NICE();
	$GLOBALS["PHP5"]=$unix->LOCATE_PHP5_BIN();
	$GLOBALS["SU"]=$unix->find_program("su");
	
	$users=new settings_inc();
	$sock=new sockets();
	$GLOBALS["SQUID_INSTALLED"]=$users->SQUID_INSTALLED;
	$GLOBALS["POSTFIX_INSTALLED"]=$users->POSTFIX_INSTALLED;
	$GLOBALS["SAMBA_INSTALLED"]=$users->SAMBA_INSTALLED;
	$GLOBALS["GREYHOLE_INSTALLED"]=$users->GREYHOLE_INSTALLED;
	$GLOBALS["MUNIN_CLIENT_INSTALLED"]=$users->SAMBA_INSTALLED;
	$GLOBALS["CYRUS_IMAP_INSTALLED"]=$users->cyrus_imapd_installed;
	$_GET["MIME_DEFANGINSTALLED"]=$users->MIMEDEFANG_INSTALLED;
	$GLOBALS["DANSGUARDIAN_INSTALLED"]=$users->DANSGUARDIAN_INSTALLED;
	$GLOBALS["OPENVPN_INSTALLED"]=$users->OPENVPN_INSTALLED;
	$GLOBALS["OCS_INSTALLED"]=$users->OCSI_INSTALLED;
	$GLOBALS["UFDBGUARD_INSTALLED"]=$users->APP_UFDBGUARD_INSTALLED;
	$GLOBALS["KAS_INSTALLED"]=$users->kas_installed;
	$GLOBALS["ZARAFA_INSTALLED"]=$users->ZARAFA_INSTALLED;
	$GLOBALS["XAPIAN_PHP_INSTALLED"]=$users->XAPIAN_PHP_INSTALLED;
	$GLOBALS["AUDITD_INSTALLED"]=$users->APP_AUDITD_INSTALLED;
	$GLOBALS["VIRTUALBOX_INSTALLED"]=$users->VIRTUALBOX_INSTALLED;
	if($GLOBALS["VERBOSE"]){writelogs("DANSGUARDIAN_INSTALLED={$GLOBALS["DANSGUARDIAN_INSTALLED"]}","MAIN",__FILE__,__LINE__);}
	$GLOBALS["EnableArticaWatchDog"]=GET_INFO_DAEMON("EnableArticaWatchDog");
	if($GLOBALS["VERBOSE"]){if($GLOBALS["POSTFIX_INSTALLED"]){events("Postfix is installed...");}}
	if($GLOBALS["VERBOSE"]){events("Nice=\"\", php5 {$GLOBALS["PHP5"]}");}	
	$GLOBALS["EnableInterfaceMailCampaigns"]=$sock->GET_INFO("EnableInterfaceMailCampaigns");
	$GLOBALS["CLASS_SOCKETS"]=$sock;
	$GLOBALS["TOTAL_MEMORY_MB"]=$unix->TOTAL_MEMORY_MB();
	$sock=null;
	$unix=null;
	$users=null;
	
	
	}