Exemple #1
0
if(preg_match("#--verbose#",implode(" ",$argv))){$GLOBALS["VERBOSE"]=true;}
if(preg_match("#--force#",implode(" ",$argv))){$GLOBALS["FORCE"]=true;}


$unix=new unix();
$pidfile="/etc/artica-postfix/".basename(__FILE__)."pid";
$currentpid=trim(@file_get_contents($pidefile));
if($unix->process_exists($currentpid)){die();}

@file_put_contents($pidfile,getmypid());


if($argv[1]=="--loadavg"){loadavg();exit;}
if($argv[1]=="--mem"){loadmem();exit;}
if($argv[1]=="--cpu"){loadcpu();exit;}
if($argv[1]=="--queues"){ParseLoadQeues();exit;}



checkProcess1();

function checkProcess1(){
	
	$unix=new unix();
	$pid=$unix->PIDOF_PATTERN("bin/process1");
	if($pid<5){return null;}
	$process1=$unix->PROCCESS_TIME_MIN($pid);
	$mem=$unix->PROCESS_MEMORY($pid);
	Myevents("process1: $pid ($process1 mn) memory:$mem Mb",__FUNCTION__);
	
	if($mem>30){
Exemple #2
0
}
@file_put_contents($pidfile, getmypid());
if ($argv[1] == "--loadavg") {
    loadavg();
    die;
}
if ($argv[1] == "--mem") {
    loadmem();
    die;
}
if ($argv[1] == "--cpu") {
    loadcpu();
    die;
}
if ($argv[1] == "--queues") {
    ParseLoadQeues();
    die;
}
if ($argv[1] == "--loadavg-notif") {
    loadavg_notif();
    die;
}
checkProcess1();
function startprocess($APP_NAME, $cmd)
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "/pids/" . __FUNCTION__ . "." . $APP_NAME . ".pid";
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        writelogs("Already process {$pid} exists", __FUNCTION__, __FILE__, __LINE__);
        return;