示例#1
0
<?php
include_once(dirname(__FILE__).'/framework/frame.class.inc');
include_once(dirname(__FILE__).'/framework/class.unix.inc');
include_once(dirname(__FILE__).'/ressources/class.http.pear.inc');
include_once(dirname(__FILE__).'/ressources/class.artica-meta.inc');
include_once(dirname(__FILE__).'/ressources/class.os.system.inc');
include_once(dirname(__FILE__).'/ressources/class.system.network.inc');

	if(posix_getuid()<>0){die("Cannot be used in web server mode\n\n");}
	if(preg_match("#--verbose#",implode(" ",$argv))){$GLOBALS["VERBOSE"]=true;}
	if(preg_match("#--force#",implode(" ",$argv))){$GLOBALS["FORCE"]=true;}

if($argv[1]=='--build'){build();exit;}
if($argv[1]=='--stats'){build_stats();exit;}
	
function build(){
$unix=new unix();
$vnstat=$unix->find_program("vnstat");

if(!is_file($vnstat)){
	echo "Starting......: VnStat Not installed\n";
	return;
}

$conf[]="# vnStat 1.10 config file";
$conf[]="##";
$conf[]="";
$conf[]="# default interface";
$conf[]="Interface \"eth0\"";
$conf[]="";
$conf[]="# location of the database directory";
示例#2
0
    $GLOBALS["VERBOSE"] = true;
}
if (preg_match("#--force#", implode(" ", $argv))) {
    $GLOBALS["FORCE"] = true;
}
$system_is_overloaded = system_is_overloaded();
writelogs("System is overloaded, aborting...", "MAIN", __FILE__, __LINE__);
if ($system_is_overloaded) {
    die;
}
if ($argv[1] == '--build') {
    build();
    exit;
}
if ($argv[1] == '--stats') {
    build_stats();
    exit;
}
function build()
{
    $unix = new unix();
    $vnstat = $unix->find_program("vnstat");
    if (!is_file($vnstat)) {
        echo "Starting......: VnStat Not installed\n";
        return;
    }
    $conf[] = "# vnStat 1.10 config file";
    $conf[] = "##";
    $conf[] = "";
    $conf[] = "# default interface";
    $conf[] = "Interface \"eth0\"";