本文整理汇总了PHP中LOCATE_PHP5_BIN函数的典型用法代码示例。如果您正苦于以下问题:PHP LOCATE_PHP5_BIN函数的具体用法?PHP LOCATE_PHP5_BIN怎么用?PHP LOCATE_PHP5_BIN使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOCATE_PHP5_BIN函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install_key
function install_key($keyfile)
{
$path = "/usr/share/artica-postfix/ressources/conf/upload/{$keyfile}";
$license_bin = "/opt/kaspersky/kav4proxy/bin/kav4proxy-licensemanager";
$time = time();
$unix = new unix();
$pidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = $unix->get_pid_from_file($pidFile);
if ($unix->process_exists($pid)) {
if ($unix->PROCCESS_TIME_MIN($pid, 10) < 2) {
progress("{failed} Already running", 110);
echo "Already runinng PID {$pid}\n";
return;
}
}
echo "License....: {$path}\n";
echo "Binary File: {$license_bin}\n";
if (!is_file($path)) {
echo "{$path} No such file..\n";
progress("{failed} {$keyfile} No such file", 110);
die;
}
if (!is_file($license_bin)) {
echo "{$path} No such file..\n";
progress("{failed} " . basename($license_bin) . " No such binary", 110);
@unlink($path);
die;
}
$sock = new sockets();
$nohup = $unix->find_program("nohup");
$sock->SET_INFO("kavicapserverEnabled", 1);
@unlink("/etc/artica-postfix/kav4proxy-licensemanager");
@unlink("/etc/artica-postfix/kav4proxy-licensemanager-i");
progress("{removing_old_licenses}", 20);
system("/opt/kaspersky/kav4proxy/bin/kav4proxy-licensemanager -d a");
progress("{installing} {$keyfile}", 30);
$cmd = "/opt/kaspersky/kav4proxy/bin/kav4proxy-licensemanager -c /etc/opt/kaspersky/kav4proxy.conf -a {$path}";
system($cmd);
@unlink($path);
progress("{analyze_license} {$keyfile}", 50);
shell_exec("/opt/kaspersky/kav4proxy/bin/kav4proxy-licensemanager -i >/etc/artica-postfix/kav4proxy-licensemanager-i 2>&1");
progress("{stopping_service}", 60);
echo "/etc/init.d/kav4proxy stop\n";
system("/etc/init.d/kav4proxy stop");
progress("{starting_service}", 60);
echo "/etc/init.d/kav4proxy start\n";
system("{$nohup} /etc/init.d/kav4proxy start >/dev/null 2>&1 &");
system("{$nohup} /etc/init.d/artica-status restart --force >/dev/null 2>&1 &");
progress("{launch_updates}", 70);
$nohup = $unix->find_program("nohup");
$php = $unix - LOCATE_PHP5_BIN();
sleep(2);
progress("{launch_updates}", 80);
shell_exec("{$nohup} /usr/share/artica-postfix/exec.keepup2date.php --update --force >/dev/null 2>&1 &");
sleep(3);
progress("{success}", 100);
}
示例2: SaveGlobal
function SaveGlobal()
{
$samba = new samba();
$shared_name = $_GET["ShareName"];
$php5 = LOCATE_PHP5_BIN();
$folder_name = $samba->GetShareName("/media/{$_GET["uuid"]}");
if ($folder_name == null) {
$samba->main_array["{$shared_name}"]["path"] = "/media/{$_GET["uuid"]}";
$samba->main_array["{$shared_name}"]["create mask"] = "0777";
$samba->main_array["{$shared_name}"]["directory mask"] = "0777";
$samba->main_array["{$shared_name}"]["root preexec"] = "{$php5} /usr/share/artica-postfix/exec.samba.php --usb-mount {$_GET["uuid"]} %u";
$samba->main_array["{$shared_name}"]["root postexec"] = "{$php5} /usr/share/artica-postfix/exec.samba.php --usb-umount {$_GET["uuid"]} %u";
$samba->main_array["{$shared_name}"]["root preexec close"] = "yes";
$samba->SaveToLdap();
} else {
$samba->main_array["{$folder_name}"]["path"] = "/media/{$_GET["uuid"]}";
$samba->main_array["{$folder_name}"]["create mask"] = "0777";
$samba->main_array["{$folder_name}"]["directory mask"] = "0777";
$samba->main_array["{$folder_name}"]["root preexec"] = "{$php5} /usr/share/artica-postfix/exec.samba.php --usb-mount {$_GET["uuid"]} %u";
$samba->main_array["{$folder_name}"]["root postexec"] = "{$php5} /usr/share/artica-postfix/exec.samba.php --usb-umount {$_GET["uuid"]} %u";
$samba->main_array["{$folder_name}"]["root preexec close"] = "yes";
$samba->SaveToLdap();
}
}
示例3: VirtualBoxList
function VirtualBoxList()
{
if ($GLOBALS["VERBOSE"]) {
echo "starting analyze VirtualBox machines...\n";
}
$users = new usersMenus();
if (!$users->VIRTUALBOX_INSTALLED) {
events("Virtualbox not installed...", __FUNCTION__, __FILE__, __LINE__);
if ($GLOBALS["VERBOSE"]) {
echo "terminated... (" . __LINE__ . ")\n";
}
return null;
}
$sock = new sockets();
$array = unserialize(base64_decode($sock->getFrameWork("cmd.php?virtualbox-list-vms=yes")));
if (!is_array($array)) {
events("Not an array", __FUNCTION__, __FILE__, __LINE__);
if ($GLOBALS["VERBOSE"]) {
echo "terminated... (" . __LINE__ . ")\n";
}
return;
}
while (list($vboxname, $vboxArray) = each($array)) {
if ($GLOBALS["VERBOSE"]) {
echo "check {$vboxname} (" . __LINE__ . ")\n";
}
$CPUSTATS = unserialize(base64_decode($sock->getFrameWork("cmd.php?virtualbox-showcpustats=yes&virtual-machine=" . base64_encode($vboxname))));
$array[$vboxname]["METRICS"] = $CPUSTATS;
}
reset($array);
$EXEC_NICE = EXEC_NICE();
if (is_file("/usr/bin/nohup")) {
$nohup = "/usr/bin/nohup ";
}
$cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-virtualbox-logs >/dev/null 2>&1 &";
shell_exec($cmd);
return base64_encode(serialize($array));
}
示例4: buildcron
function buildcron()
{
$unix = new unix();
$path = "/etc/cron.d";
$sql = "SELECT * FROM backup_schedules ORDER BY ID DESC";
$q = new mysql();
$results = $q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
return null;
}
$files = $unix->DirFiles("/etc/cron.d");
while (list($num, $filename) = each($files)) {
if (preg_match("#artica-backup-([0-9]+)\$#", $filename)) {
echo "Starting......: " . date("H:i:s") . " Backup remove {$filename}\n";
@unlink("{$path}/{$filename}");
}
}
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$schedule = $ligne["schedule"];
echo "Starting......: " . date("H:i:s") . " Backup {$schedule}\n";
$f[] = "{$schedule} " . LOCATE_PHP5_BIN() . " " . __FILE__ . " {$ligne["ID"]} >/dev/null 2>&1";
}
@file_put_contents("/etc/artica-postfix/backup.tasks", @implode("\n", $f));
if (!$GLOBALS["NO_RELOAD"]) {
system("/etc/init.d/artica-postfix restart daemon");
}
}
示例5: DNS_DEL_ENTRY
function DNS_DEL_ENTRY($value)
{
$hostname = base64_decode($value);
$EXEC_NICE = EXEC_NICE();
if (is_file("/usr/bin/nohup")) {
$nohup = "/usr/bin/nohup ";
}
$reload_datas = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-dns >/dev/null 2>&1 &";
include_once dirname(__FILE__) . "/ressources/class.pdns.inc";
$ldap = new clladp();
$upd = array();
$tbl = explode(".", $hostname);
$dc = "dc=" . @implode(",dc=", $tbl);
if ($ldap->ExistsDN("{$dc},ou=dns,{$ldap->suffix}")) {
if ($ldap->ldap_delete("{$dc},ou=dns,{$ldap->suffix}", true)) {
send_email_events("Success deleting DNS entry {$hostname}", "DN removed was : {$dc},ou=dns,{$ldap->suffix}", "CLOUD");
return true;
}
} else {
events("unable to stat {$dc},ou=dns,{$ldap->suffix}", __FUNCTION__, __FILE__, __LINE__);
}
$suffix = "ou=dns,{$ldap->suffix}";
$pattern = "(&(objectclass=*)(associatedDomain={$hostname}))";
$sr = @ldap_search($ldap->ldap_connection, $suffix, "{$pattern}", array());
if ($sr) {
$hash = ldap_get_entries($ldap->ldap_connection, $sr);
for ($i = 0; $i < $hash["count"]; $i++) {
$dn = $hash[$i]["dn"];
if (strlen($dn) > 0) {
$dns[] = $dn;
events("removing associateddomain={$hostname} in {$dn}", __FUNCTION__, __FILE__, __LINE__);
$upd["associateddomain"] = $hostname;
if (!$ldap->Ldap_del_mod($dn, $upd)) {
$dns[] = $ldap->ldap_last_error;
}
}
}
send_email_events("Success executing remove DNS entry {$hostname}", @implode("\n", $dns), "CLOUD");
return true;
}
events("Failed -> notify", __FUNCTION__, __FILE__, __LINE__);
send_email_events("Failed remove DNS entry {$hostname} does not exists", null, "CLOUD");
shell_exec($reload_datas);
return true;
}
示例6: set_computer_schedules
function set_computer_schedules(){
writelogs("set_computer_schedules:: starting",__FUNCTION__,__FILE__,__LINE__);
$ldap=new clladp();
$pattern="(&(objectClass=ArticaComputerInfos)(ComputerScanSchedule=*))";
$attr=array("cn","ComputerScanSchedule","uid");
$sr =@ldap_search($ldap->ldap_connection,$ldap->suffix,$pattern,$attr);
if(!$sr){
events("set_computer_schedules():: $ldap->ldap_last_error line: ".__LINE__);
return false;
}
$hash=ldap_get_entries($ldap->ldap_connection,$sr);
for($i=0;$i<$hash["count"];$i++){
$uid=$hash[$i]["uid"][0];
$computerscanschedule=$hash[$i]["computerscanschedule"][0];
$filename="$uid";
$filename=str_replace('.','',$filename);
$filename=str_replace('$','',$filename);
$filename=str_replace(' ','',$filename);
$filename=str_replace('-','',$filename);
$filename=str_replace('_','',$filename);
sys_CRON_CREATE_SCHEDULE($computerscanschedule,LOCATE_PHP5_BIN()." ".__FILE__." $uid","artica-av-$filename");
}
}
示例7: system_is_overloaded
$GLOBALS["cpuLimitEnabled"] = true;
} else {
$GLOBALS["cpuLimitEnabled"] = false;
}
$GLOBALS["OVERLOADED"] = system_is_overloaded();
if ($GLOBALS["OVERLOADED"]) {
writelogs("This system is overloaded", __FUNCTION__, __FILE__, __LINE__);
if ($GLOBALS["cpuLimitEnabled"]) {
if (GET_INFO_DAEMON("cpulimit") > 0) {
shell_exec("/usr/share/artica-postfix/bin/process1 --cpulimit");
}
}
}
$dirname = dirname(__FILE__);
$_GET["NICE"] = EXEC_NICE();
$_GET["PHP5"] = LOCATE_PHP5_BIN();
$users = new usersMenus();
$sock = new sockets();
$GLOBALS["SQUID_INSTALLED"] = $users->SQUID_INSTALLED;
$GLOBALS["POSTFIX_INSTALLED"] = $users->POSTFIX_INSTALLED;
$GLOBALS["SAMBA_INSTALLED"] = $users->SAMBA_INSTALLED;
$_GET["MIME_DEFANGINSTALLED"] = $users->MIMEDEFANG_INSTALLED;
$GLOBALS["DANSGUARDIAN_INSTALLED"] = $users->DANSGUARDIAN_INSTALLED;
$GLOBALS["KAS_INSTALLED"] = $users->kas_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...");
示例8: ParseEvents
//.........这里部分代码省略.........
$subject = $text;
} else {
$subject = substr($text, 0, 75) . "...";
}
}
}
if (strlen($subject) < 5) {
writelogs("Warning New notification: Subject seems to be empty ! \"{$text}\" removing {$path}/{$file}", __FUNCTION__, __FILE__, __LINE__);
@unlink("{$path}/{$file}");
continue;
}
if (strpos($users->hostname, ".") > 0) {
$ty = explode($users->hostname, ".");
$users->hostname = $ty[0];
}
if (strlen($text) < 5) {
$text = "No content body as been added for this notification";
}
$sql = "INSERT IGNORE INTO events (zDate,hostname,process,text,context,content,attached_files,recipient,event_id) VALUES(\n \t'{$date}',\n \t'{$users->hostname}',\n \t'{$processname}',\n \t'{$subject}',\n \t'{$context}','{$text}','{$files_text}','{$recipient}','{$event_id}')";
if (!$mysql->UseMysql) {
$sql = "INSERT IGNORE INTO events (id,zDate,hostname,\n \tprocess,text,context,content,attached_files,recipient,event_id) VALUES(\n \t'{$event_id}','{$date}',\n \t'{$users->hostname}',\n \t'{$processname}',\n \t'{$subject}',\n \t'{$context}','{$text}','{$files_text}','{$recipient}','{$event_id}')";
}
events(date('Y-m-d h:i:s') . " run mysql query -> {$subject}");
if (!$mysql->QUERY_SQL($sql, 'artica_events')) {
events("Mysql error keep {$path}/{$file};");
events("Fatal: {$mysql->mysql_error}", __FUNCTION__, __FILE__, __LINE__);
if (preg_match("#Access denied for user.+?using password:#", $mysql->mysql_error)) {
events("Access denied for user password: {$mysql->mysql_server}@{$mysql->mysql_admin}:{$mysql->mysql_password} detected");
if ($mysql->mysql_server == "127.0.0.1" or $mysql->mysql_server == "localhost") {
$ldap = new clladp();
$unix = new unix();
$ldap->ldap_password = $unix->shellEscapeChars($ldap->ldap_password);
writelogs("Try to change the mysql password: /usr/share/artica-postfix/bin/artica-install --change-mysqlroot --inline root \"secret\"", __FUNCTION__, __FILE__, __LINE__);
exec("/usr/share/artica-postfix/bin/artica-install --change-mysqlroot --inline root \"secret\" 2>&1", $chroot);
writelogs("Chaning password=" . @implode("\n", $chroot), __FUNCTION__, __FILE__, __LINE__);
die;
}
}
if (preg_match("#Unknown column#", $mysql->mysql_error)) {
events("->BuildTables()");
$mysql->BuildTables();
}
if (preg_match("#Unknown database#", $mysql->mysql_error)) {
events("->BuildTables()");
$mysql->BuildTables();
}
if (preg_match("#connect to local MySQL server through socket#", $mysql->mysql_error)) {
shell_exec("/etc/init.d/artica-postfix start mysql &");
}
writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__);
break;
}
unlink($path . '/' . $file);
if ($ArticaMetaEnabled == 1) {
$pidfile = "/etc/artica-postfix/pids/exec.artica.meta.php.SendStatus.pid";
$sock = new sockets();
$ArticaMetaPoolTimeMin = $sock->GET_INFO("ArticaMetaPoolTimeMin");
if (!is_numeric($ArticaMetaPoolTimeMin)) {
$ArticaMetaPoolTimeMin = 15;
}
if ($ArticaMetaPoolTimeMin < 2) {
$ArticaMetaPoolTimeMin = 15;
}
$minutes = file_time_min($pidfile);
if ($minutes < round($ArticaMetaPoolTimeMin / 2.5)) {
$meta->events(basename($pidfile) . ":{$minutes}<" . round($ArticaMetaPoolTimeMin / 2.5) . "Mn, aborting", __FUNCTION__, __FILE__, __LINE__);
return;
}
$http = new httpget();
$meta->events("Send notification \"{$arrayToSend["subject"]}\" to Meta Server", __FUNCTION__, __FILE__, __LINE__);
$metaconsole = $http->send("{$ArticaMetaHostname}/lic.status.notifs.php", "post", array("DATAS" => $datasToSend, "NOTIF" => base64_encode(serialize($arrayToSend))));
events("META CONSOLE: {$metaconsole} aborting notifications");
if ($metaconsole == "FAILED_CONNECT") {
$meta->events("Result:\"{$metaconsole}\"", __FUNCTION__, __FILE__, __LINE__);
return;
}
if (!is_file("/etc/artica-postfix/artica-meta.tasks")) {
if (preg_match("#<TASKS>(.+?)</TASKS>#is", $metaconsole, $re)) {
$meta->events("Save tasks to /etc/artica-postfix/artica-meta.tasks", __FUNCTION__, __FILE__, __LINE__);
@file_put_contents("/etc/artica-postfix/artica-meta.tasks", $re[1]);
$cmd = LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.tasks.php >/dev/null 2>&1 &";
$meta->events("TASKS ->{$cmd}", __FUNCTION__, __FILE__, __LINE__);
shell_exec($cmd);
}
}
}
$text = addslashes($text);
$context = addslashes($context);
$subject = addslashes($subject);
}
if (count($hash) > 0) {
events(count($hash) . " events queue parsed...");
}
if ($ArticaMetaEnabled == 1) {
if (is_file("/etc/artica-postfix/artica-meta.tasks")) {
$NICE = EXEC_NICE();
shell_exec($NICE . LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.artica.meta.tasks.php &");
}
}
}
示例9: UPGRADE
function UPGRADE()
{
$unix = new unix();
$tmpf = $unix->FILE_TEMP();
$txt = "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin\n";
$txt = $txt . "echo \$PATH >{$tmpf} 2>&1\n";
$txt = $txt . "rm -f {$tmpf}\n";
$tmpf = $unix->FILE_TEMP();
@file_put_contents($tmpf, $txt);
@chmod($tmpf, '0777');
shell_exec($tmpf);
$tmpf = $unix->FILE_TEMP();
$cmd = "DEBIAN_FRONTEND=noninteractive {$_GET["APT-GET"]} -o Dpkg::Options::=\"--force-confnew\" --force-yes update >{$tmpf} 2>&1";
writelogs($cmd, __FUNCTION__, __FILE__, __LINE__);
shell_exec($cmd);
$cmd = "DEBIAN_FRONTEND=noninteractive {$_GET["APT-GET"]} -o Dpkg::Options::=\"--force-confnew\" --force-yes --yes install -f >{$tmpf} 2>&1";
writelogs($cmd, __FUNCTION__, __FILE__, __LINE__);
shell_exec($cmd);
$cmd = "DEBIAN_FRONTEND=noninteractive {$_GET["APT-GET"]} -o Dpkg::Options::=\"--force-confnew\" --force-yes --yes upgrade >>{$tmpf} 2>&1";
writelogs($cmd, __FUNCTION__, __FILE__, __LINE__);
shell_exec($cmd);
$datas = @file_get_contents($tmpf);
$datassql = addslashes($datas);
$q = new mysql();
$sql = "INSERT INTO debian_packages_logs(zDate,package_name,events,install_type) VALUES(NOW(),'artica-upgrade','{$datassql}','upgrade');";
$q->QUERY_SQL($sql, "artica_backup");
@unlink('/etc/artica-postfix/apt.upgrade.cache');
send_email_events("Debian/Ubuntu System upgrade operation", $datas, "system");
INSERT_DEB_PACKAGES();
THREAD_COMMAND_SET(LOCATE_PHP5_BIN() . " /usr/share/artica-postfix/exec.admin.status.postfix.flow.php --services");
}
示例10: build
function build(){
CheckHttpdConf();
RemoveAllSites();
create_cron_task();
$sock=new sockets();
$unix=new unix();
$varWwwPerms=$sock->GET_INFO("varWwwPerms");
if($varWwwPerms==null){$varWwwPerms=755;}
remove_files();
$sql="SELECT * FROM freeweb ORDER BY servername";
$httpdconf=$unix->LOCATE_APACHE_CONF_PATH();
$apacheusername=$unix->APACHE_SRC_ACCOUNT();
$GLOBALS["apacheusername"]=$apacheusername;
$DAEMON_PATH=$unix->getmodpathfromconf($httpdconf);
$q=new mysql();
$results=$q->QUERY_SQL($sql,'artica_backup');
if(!$q->ok){if($GLOBALS["VERBOSE"]){echo $q->mysql_error."\n";return;}}
$d_path=$unix->APACHE_DIR_SITES_ENABLED();
$mods_enabled=$DAEMON_PATH."/mods-enabled";
echo "Starting......: Apache daemon path: $d_path\n";
echo "Starting......: Apache mods path..: $mods_enabled\n";
if(!is_dir($d_path)){@mkdir($d_path,666,true);}
if(!is_dir($mods_enabled)){@mkdir($mods_enabled,666,true);}
$count=mysql_num_rows($results);
echo "Starting......: Apache checking virtual web sites count:$count\n";
if($count==0){
$users=new usersMenus();
echo "Starting......: Apache building default $users->hostname...\n";
buildHost($unix->LIGHTTPD_USER(),$users->hostname,0,$d_path);
}
while($ligne=mysql_fetch_array($results,MYSQL_ASSOC)){
$uid=$ligne["uid"];
$hostname=$ligne["servername"];
$ssl=$ligne["useSSL"];
echo "Starting......: Apache \"$hostname\" starting
\n";
buildHost($uid,$hostname,$ssl,$d_path);
}
$users=$GLOBALS["CLASS_USERS_MENUS"];
$APACHE_MOD_AUTHNZ_LDAP=$users->APACHE_MOD_AUTHNZ_LDAP;
if(is_file($GLOBALS["a2enmod"])){
if($APACHE_MOD_AUTHNZ_LDAP){
if($GLOBALS["VERBOSE"]){echo "Starting......: Apache {$GLOBALS["a2enmod"]} authnz_ldap\n";}
shell_exec("{$GLOBALS["a2enmod"]} authnz_ldap >/dev/null 2>&1");
}
}
$sock=$GLOBALS["CLASS_SOCKETS"];
if($sock->GET_INFO("ArticaMetaEnabled")==1){
sys_THREAD_COMMAND_SET(LOCATE_PHP5_BIN()." ".dirname(__FILE__)."/exec.artica.meta.users.php --export-freewebs");
}
}
示例11: awstats_mail
//.........这里部分代码省略.........
$GLOBALS["maillogconvert"] = $unix->LOCATE_maillogconvert();
$GLOBALS["zcat"] = $unix->find_program("zcat");
$GLOBALS["perl"] = $unix->find_program("perl");
$GLOBALS["nice"] = EXEC_NICE();
$GLOBALS["sed"] = $unix->find_program("sed");
$GLOBALS["mv"] = $unix->find_program("mv");
$GLOBALS["cp"] = $unix->find_program("cp");
$GLOBALS["touch"] = $unix->find_program("touch");
$GLOBALS["echo"] = $unix->find_program("echo");
$GLOBALS["postfix"] = $unix->find_program("postfix");
if ($GLOBALS["VERBOSE"]) {
echo "maillogconvert..........:{$GLOBALS["maillogconvert"]}\n";
echo "zcat....................:{$GLOBALS["zcat"]}\n";
echo "perl....................:{$GLOBALS["perl"]}\n";
echo "nice....................:{$GLOBALS["nice"]}\n";
echo "sed.....................:{$GLOBALS["sed"]}\n";
}
if (strlen($GLOBALS["maillogconvert"]) == null) {
events("maillogconvert.pl, no such file", __FUNCTION__, __FILE__, __LINE__, "postfix-stats");
return;
}
@mkdir("/var/log/mail-backup", 666, true);
foreach (glob("/var/log/mail.log.*.gz") as $filename) {
events("{$GLOBALS["nice"]}{$GLOBALS["zcat"]} {$filename} >/tmp/mail.log");
shell_exec("{$GLOBALS["nice"]}{$GLOBALS["zcat"]} {$filename} >/tmp/mail.log");
$t1 = time();
prepflog("/tmp/mail.log");
$distanceOfTimeInWords = distanceOfTimeInWords($t1, time());
shell_exec("/bin/mv {$filename} /var/log/mail-backup/");
events("/bin/mv {$filename} /var/log/mail-backup/", __FUNCTION__, __FILE__, __LINE__, "postfix-stats");
events(basename($filename) . " {$distanceOfTimeInWords}");
$ev[] = basename($filename) . " " . $distanceOfTimeInWords;
@unlink("/tmp/mail.log");
}
foreach (glob("/var/log/mail.log.*") as $filename) {
if (!preg_match("#\\.[0-9]+\$#", basename($filename))) {
if ($GLOBALS["VERBOSE"]) {
echo basename($filename) . " SKIP\n";
}
continue;
}
$t1 = time();
prepflog($filename);
$distanceOfTimeInWords = distanceOfTimeInWords($t1, time());
if ($GLOBALS["VERBOSE"]) {
echo basename($filename) . " {$distanceOfTimeInWords}\n";
}
$ev[] = basename($filename) . " " . $distanceOfTimeInWords;
shell_exec("/bin/mv {$filename} /var/log/mail-backup/");
}
$t1 = time();
if (is_file("/var/log/mail.log")) {
$nextFile = "/var/log/mail.log." . time();
shell_exec("{$GLOBALS["cp"]} /var/log/mail.log {$nextFile}");
shell_exec("{$GLOBALS["echo"]} \"\" > /var/log/mail.log");
events("Restarting Syslogs...");
$syslog_init = $unix->RESTART_SYSLOG_FORMAIL();
prepflog($nextFile);
$storelogs = new mysql_storelogs();
events("Injecting {$nextFile} to MySQL store logs");
$storelogs->InjectFile($nextFile);
artica_parse();
events("reloading postfix");
shell_exec("{$GLOBALS["postfix"]} reload");
}
$distanceOfTimeInWords = distanceOfTimeInWords($t1, time());
$ev[] = basename("/var/log/mail.log") . " " . $distanceOfTimeInWords;
if ($GLOBALS["VERBOSE"]) {
echo basename("/var/log/mail.log") . " {$distanceOfTimeInWords}\n";
}
//$cmd="$nice$perl /usr/share/artica-postfix/bin/prepflog.pl </tmp/mail.log|$nice$perl $maillogconvert standard >>/var/log/artica-postfix/awstats-postfix.stats";
foreach (glob("/var/log/artica-mail/*.stats") as $filename) {
if (preg_match("#(.+?)\\.([0-9]+)\\.stats#", basename($filename), $re)) {
$instance = $re[1];
$time = $re[2];
$cmd = "{$GLOBALS["nice"]}{$GLOBALS["perl"]} {$GLOBALS["maillogconvert"]} standard< {$filename} >/var/log/artica-mail/{$instance}.{$time}.aws";
events($cmd);
shell_exec($cmd);
@unlink($filename);
if (system_is_overloaded(basename(__FILE__))) {
system_admin_events("Overloaded system, aborting", __FUNCTION__, __FILE__, __LINE__, "postfix-stats");
return;
}
}
}
$filecount = 0;
foreach (glob("/var/log/artica-mail/*.aws") as $filename) {
artica_parse($filename);
$filecount++;
$filecountl[] = $filename;
}
$distanceOfTimeInWords = distanceOfTimeInWords($tt1, time());
if ($filecount > 0) {
system_admin_events("Success generating {$filecount} stats files ({$distanceOfTimeInWords})\n" . @implode("\n", $filename), __FUNCTION__, __FILE__, __LINE__, "postfix-stats");
if ($ArticaMetaEnabled == 1) {
$cmd = "{$GLOBALS["nice"]}" . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-postfix-events >/dev/null 2>&1 &";
shell_exec($cmd);
}
}
}
示例12: build
function build()
{
$unix = new unix();
if (is_file("/etc/artica-postfix/FROM_ISO")) {
if ($unix->file_time_min("/etc/artica-postfix/FROM_ISO") < 1) {
return;
}
}
$mef = basename(__FILE__);
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid, $mef)) {
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache building : Process Already exist pid {$pid} line:" . __LINE__ . "\n";
return;
}
@file_put_contents($pidfile, getmypid());
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache -> CheckHttpdConf();\n";
}
CheckHttpdConf();
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache -> RemoveAllSites();\n";
}
RemoveAllSites();
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache -> create_cron_task();\n";
}
create_cron_task();
sync_squid();
$sock = new sockets();
$FreeWebDisableSSL = intval(trim($sock->GET_INFO("FreeWebDisableSSL")));
$php5 = $unix->LOCATE_PHP5_BIN();
$varWwwPerms = $sock->GET_INFO("varWwwPerms");
if ($varWwwPerms == null) {
$varWwwPerms = 755;
}
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache -> remove_files();\n";
}
remove_files();
$sql = "SELECT * FROM freeweb ORDER BY servername";
$httpdconf = $unix->LOCATE_APACHE_CONF_PATH();
$apacheusername = $unix->APACHE_SRC_ACCOUNT();
$GLOBALS["apacheusername"] = $apacheusername;
$DAEMON_PATH = $unix->getmodpathfromconf($httpdconf);
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache -> sql();\n";
}
$q = new mysql();
$results = $q->QUERY_SQL($sql, 'artica_backup');
if (!$q->ok) {
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [DEBUG]: Apache {$q->mysql_error}\n";
return;
}
}
$d_path = $unix->APACHE_DIR_SITES_ENABLED();
$mods_enabled = $DAEMON_PATH . "/mods-enabled";
if ($FreeWebDisableSSL == 0) {
SSL_DEFAULT_VIRTUAL_HOST();
}
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache daemon path: {$d_path}\n";
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache mods path..: {$mods_enabled}\n";
if (!is_dir($d_path)) {
@mkdir($d_path, 666, true);
}
if (!is_dir($mods_enabled)) {
@mkdir($mods_enabled, 666, true);
}
$count = mysql_num_rows($results);
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache checking virtual web sites count:{$count}\n";
if ($count == 0) {
$users = new usersMenus();
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache building default {$users->hostname}...\n";
buildHost($unix->LIGHTTPD_USER(), $users->hostname, 0, $d_path);
}
if ($GLOBALS["VERBOSE"]) {
$add_plus = " --verbose";
}
while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
$uid = $ligne["uid"];
$hostname = $ligne["servername"];
$ssl = $ligne["useSSL"];
if ($FreeWebDisableSSL == 1) {
$ssl = 0;
}
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache \"{$hostname}\" starting\n";
$cmd = "{$php5} " . __FILE__ . " --sitename \"{$hostname}\" --no-httpd-conf --noreload{$add_plus}";
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache \"{$cmd}\"\n";
}
shell_exec($cmd);
}
$users = $GLOBALS["CLASS_USERS_MENUS"];
$APACHE_MOD_AUTHNZ_LDAP = $users->APACHE_MOD_AUTHNZ_LDAP;
if (is_file($GLOBALS["a2enmod"])) {
if ($APACHE_MOD_AUTHNZ_LDAP) {
if ($GLOBALS["VERBOSE"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: Apache {$GLOBALS["a2enmod"]} authnz_ldap\n";
}
//.........这里部分代码省略.........
示例13: die
die("Cannot be used in web server mode\n\n");
}
if (!Build_pid_func(__FILE__, "MAIN")) {
events(basename(__FILE__) . " Already executed.. aborting the process");
die;
}
$pid = getmypid();
$pidfile = "/etc/artica-postfix/" . basename(__FILE__) . ".pid";
@mkdir("/var/log/artica-postfix/xapian", 0755, true);
@mkdir("/var/log/artica-postfix/infected-queue", 0755, true);
events("running {$pid} ");
file_put_contents($pidfile, $pid);
include_once dirname(__FILE__) . '/ressources/class.ini.inc';
include_once dirname(__FILE__) . '/ressources/class.users.menus.inc';
$GLOBALS["RSYNC_RECEIVE"] = array();
$GLOBALS["LOCATE_PHP5_BIN"] = LOCATE_PHP5_BIN();
$users = new usersMenus();
$_GET["server"] = $users->hostname;
$pipe = fopen("php://stdin", "r");
while (!feof($pipe)) {
$buffer .= fgets($pipe, 4096);
try {
Parseline($buffer);
} catch (Exception $e) {
events("fatal error:" . $e->getMessage());
}
$buffer = null;
}
fclose($pipe);
events("Shutdown...");
die;