function status_right() { $postfix = $_GET["CURRENT_MEMORY"] . BuildStatusRight(); @file_put_contents('/usr/share/artica-postfix/ressources/logs/status.right.1.html', "{$postfix}{$switch}"); @chmod('/usr/share/artica-postfix/ressources/logs/status.right.1.html', 777); events(__FUNCTION__ . "() done.."); }
function status_right() { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $cachefile = "/usr/share/artica-postfix/ressources/logs/status.right.1.html"; $cachemem = "/usr/share/artica-postfix/ressources/logs/status.memory.html"; if (is_file($cachefile)) { $minutes = file_time_min($pidfile); if ($minutes < 10) { events("Stopping status, currently {$minutes}Mn need to wait 10Mn (" . filesize($cachefile) . " Bytes)", __FUNCTION__, __FILE__, __LINE__); events("{$cachefile} (" . filesize($cachefile) . " Bytes)", __FUNCTION__, __FILE__, __LINE__); @chmod($cachefile, 0777); return; } } $pid = @file_get_contents($pidfile); $unix = new unix(); if ($unix->process_exists($pid)) { events("Stopping status, Process Already running", __FUNCTION__, __FILE__, __LINE__); return; } @file_put_contents($pidfile, @getmypid()); $postfix = BuildStatusRight(); @unlink($cachefile); @file_put_contents($cachefile, "{$postfix}"); @file_put_contents($cachemem, $_GET["CURRENT_MEMORY"]); shell_exec("/bin/chmod 777 {$cachefile} >/dev/null"); shell_exec("/bin/chmod 777 {$cachemem} >/dev/null"); events(__FUNCTION__ . "() done.."); }