Ajout classe de logs
This commit is contained in:
parent
6748cf3c6d
commit
687e461324
|
@ -241,6 +241,8 @@ bureau/admin/js/prototype.js -text
|
||||||
bureau/admin/login.php -text
|
bureau/admin/login.php -text
|
||||||
bureau/admin/logo.png -text
|
bureau/admin/logo.png -text
|
||||||
bureau/admin/logo2.png -text
|
bureau/admin/logo2.png -text
|
||||||
|
bureau/admin/logs_download.php -text
|
||||||
|
bureau/admin/logs_list.php -text
|
||||||
bureau/admin/mail_add.php -text
|
bureau/admin/mail_add.php -text
|
||||||
bureau/admin/mail_alias_create.inc.php -text
|
bureau/admin/mail_alias_create.inc.php -text
|
||||||
bureau/admin/mail_alias_doedit.php -text
|
bureau/admin/mail_alias_doedit.php -text
|
||||||
|
@ -336,6 +338,7 @@ bureau/class/m_export.php -text
|
||||||
bureau/class/m_ftp.php -text
|
bureau/class/m_ftp.php -text
|
||||||
bureau/class/m_hooks.php -text
|
bureau/class/m_hooks.php -text
|
||||||
bureau/class/m_hta.php -text
|
bureau/class/m_hta.php -text
|
||||||
|
bureau/class/m_log.php -text
|
||||||
bureau/class/m_mail.php -text
|
bureau/class/m_mail.php -text
|
||||||
bureau/class/m_mail_alias.php -text
|
bureau/class/m_mail_alias.php -text
|
||||||
bureau/class/m_mail_jabber.php -text
|
bureau/class/m_mail_jabber.php -text
|
||||||
|
@ -410,6 +413,7 @@ etc/alternc/alternc-sudoers -text
|
||||||
etc/alternc/alternc.ini -text
|
etc/alternc/alternc.ini -text
|
||||||
etc/alternc/apache2-ssl.conf -text
|
etc/alternc/apache2-ssl.conf -text
|
||||||
etc/alternc/apache2.conf -text
|
etc/alternc/apache2.conf -text
|
||||||
|
etc/alternc/apache_logformat.conf -text
|
||||||
etc/alternc/dbusers.cnf.sample -text
|
etc/alternc/dbusers.cnf.sample -text
|
||||||
etc/alternc/functions_hosting/hosting_massvhost.sh -text
|
etc/alternc/functions_hosting/hosting_massvhost.sh -text
|
||||||
etc/alternc/menulist.txt -text
|
etc/alternc/menulist.txt -text
|
||||||
|
@ -503,8 +507,10 @@ src/alternc-check -text
|
||||||
src/alternc-dboptimize -text
|
src/alternc-dboptimize -text
|
||||||
src/alternc-passwd -text
|
src/alternc-passwd -text
|
||||||
src/alternc_reload -text
|
src/alternc_reload -text
|
||||||
|
src/compress_logs.sh -text
|
||||||
src/cron_users.sh -text
|
src/cron_users.sh -text
|
||||||
src/cron_users_doit.sh -text
|
src/cron_users_doit.sh -text
|
||||||
|
src/delete_logs.sh -text
|
||||||
src/du.pl -text
|
src/du.pl -text
|
||||||
src/export_account.php -text
|
src/export_account.php -text
|
||||||
src/fixperms.sh -text
|
src/fixperms.sh -text
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
$Id: logs_download.php,v 1.2 2004/09/06 18:14:36 anonymous Exp $
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
AlternC - Web Hosting System
|
||||||
|
Copyright (C) 2002 by the AlternC Development Team.
|
||||||
|
http://alternc.org/
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Based on:
|
||||||
|
Valentin Lacambre's web hosting softwares: http://altern.org/
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
LICENSE
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License (GPL)
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Original Author of file: Sonntag Benjamin
|
||||||
|
Purpose of file: Return the current folder in a compressed file
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
require_once("../class/config.php");
|
||||||
|
|
||||||
|
$fields = array (
|
||||||
|
"file" => array ("request", "string", ""),
|
||||||
|
);
|
||||||
|
getFields($fields);
|
||||||
|
|
||||||
|
if (empty($file)) {
|
||||||
|
$error="";
|
||||||
|
}
|
||||||
|
|
||||||
|
$log->download_link($file);
|
||||||
|
?>
|
|
@ -0,0 +1,68 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
$Id: log_list.php,v 1.8 2006/02/16 16:26:28 benjamin Exp $
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
AlternC - Web Hosting System
|
||||||
|
Copyright (C) 2002 by the AlternC Development Team.
|
||||||
|
http://alternc.org/
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Based on:
|
||||||
|
Valentin Lacambre's web hosting softwares: http://altern.org/
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
LICENSE
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License (GPL)
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Original Author of file: Lerider Steven
|
||||||
|
Purpose of file: Manage the log listing of a user
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
require_once("../class/config.php");
|
||||||
|
include_once("head.php");
|
||||||
|
|
||||||
|
$list=$log->list_logs_directory_all($log->get_logs_directory());
|
||||||
|
?>
|
||||||
|
<h3><?php __("Logs Listing"); ?></h3>
|
||||||
|
<hr id="topbar"/>
|
||||||
|
<br />
|
||||||
|
<?php
|
||||||
|
if (isset($error) && $error) {
|
||||||
|
echo "<p class=\"error\">$error</p>";
|
||||||
|
}
|
||||||
|
if(!$list || empty($list)){
|
||||||
|
echo "<p class=\"error\">"._("You have no sql logs to list a the moment.")."</p>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<table class="tlist">
|
||||||
|
<tr><th><?php __("Name");?></th><th align=center><?php __("Creation Date"); ?></th><th><?php __("Size"); ?></th><th><?php __("Download link");?></th></tr>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$col=1;
|
||||||
|
//listing of every mail of the current domain.
|
||||||
|
echo "<pre>";
|
||||||
|
while (list($key,$val)=each($list)){
|
||||||
|
$col=3-$col;
|
||||||
|
foreach($val as $k => $v){
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $v['name']; ?></td>
|
||||||
|
<td><?php echo $v['creation_date']; ?></td>
|
||||||
|
<td><?php echo format_size($v['filesize']); ?></td>
|
||||||
|
<td><?php echo "<a href=\"".$v['downlink']."\">"._("Download")."</a>";?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
|
@ -35,6 +35,11 @@ mt_srand((float) $sec + ((float) $usec * 100000));
|
||||||
/* Format a field value for input or textarea : */
|
/* Format a field value for input or textarea : */
|
||||||
function fl($str) { return str_replace("<","<",str_replace("\"",""",$str)); }
|
function fl($str) { return str_replace("<","<",str_replace("\"",""",$str)); }
|
||||||
|
|
||||||
|
// Use of m_log
|
||||||
|
function compare_logname($a, $b) {
|
||||||
|
return strcmp($a['name'],$b['name']);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check if a domain can be hosted on this server :
|
Check if a domain can be hosted on this server :
|
||||||
Return a negative value in case of an error,
|
Return a negative value in case of an error,
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
$Id: m_log.php,v 1.4 2004/05/19 14:23:06 benjamin Exp $
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
LICENSE
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License (GPL)
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Original Author of file: Steven Lerider
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Classe de gestion des erreurs apparaissant lors d'appels API.
|
||||||
|
*
|
||||||
|
* <p>Cette classe gère les logs utilisasteurs
|
||||||
|
* </p>
|
||||||
|
* Copyleft {@link http://alternc.net/ AlternC Team}
|
||||||
|
*
|
||||||
|
* @copyright AlternC-Team 2002-11-01 http://alternc.net/
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class m_log {
|
||||||
|
|
||||||
|
function m_log(){
|
||||||
|
}
|
||||||
|
|
||||||
|
function list_logs_directory($dir){
|
||||||
|
global $cuid,$err;
|
||||||
|
$err->log("log","list_logs_directory");
|
||||||
|
|
||||||
|
$dir2=$dir;
|
||||||
|
if ($dir = @opendir($dir)) {
|
||||||
|
while (($file = readdir($dir)) !== false) {
|
||||||
|
if ($file!="." && $file!=".." && realpath($dir2 . "/" . $file) == $dir2 . "/" . $file){
|
||||||
|
$absfile=$dir2."/".$file;
|
||||||
|
$c[]=array("name"=>$file,
|
||||||
|
"creation_date"=>date("F d Y H:i:s.", filectime($absfile)),
|
||||||
|
"filesize"=>filesize($absfile),
|
||||||
|
"downlink"=>"logs_download.php?file=".urlencode($file),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($dir);
|
||||||
|
}
|
||||||
|
usort($c,"compare_logname");
|
||||||
|
return $c;
|
||||||
|
|
||||||
|
}//list_logs
|
||||||
|
|
||||||
|
function list_logs_directory_all($dirs){
|
||||||
|
global $err;
|
||||||
|
$err->log("log","get_logs_directory_all");
|
||||||
|
$c=array();
|
||||||
|
foreach($dirs as $dir=>$val){
|
||||||
|
$c[$dir]=$this->list_logs_directory($val);
|
||||||
|
}
|
||||||
|
return $c;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_logs_directory(){
|
||||||
|
global $cuid,$db,$err;
|
||||||
|
$err->log("log","get_logs_directory");
|
||||||
|
|
||||||
|
$db->query("select login from membres where uid=$cuid ;");
|
||||||
|
if ($db->num_rows()==0) {
|
||||||
|
$err->raise("log",1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$db->next_record();
|
||||||
|
$c=array("dir"=>"/var/alternc/logs/".$cuid."-".$db->f("login"));
|
||||||
|
return $c;
|
||||||
|
}
|
||||||
|
|
||||||
|
function download_link($file){
|
||||||
|
global $err,$mem;
|
||||||
|
$err->log("log","download_link");
|
||||||
|
header("Content-Disposition: attachment; filename=".$mem->user["login"].".zip");
|
||||||
|
header("Content-Type: application/force-download");
|
||||||
|
header("Content-Transfer-Encoding: binary");
|
||||||
|
$f=$this->get_logs_directory();
|
||||||
|
$ff=$f['dir']."/".basename($file);
|
||||||
|
set_time_limit(0);
|
||||||
|
readfile($ff);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // end class
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
# Every day at 4am, produce raw statistics
|
# Every day at 4am, produce raw statistics
|
||||||
0 4 * * * root /usr/lib/alternc/rawstat.daily
|
0 4 * * * root /usr/lib/alternc/rawstat.daily
|
||||||
|
|
||||||
|
# Every 2 days compress log files
|
||||||
|
0 4 * * * root /usr/lib/alternc/compress_logs.sh
|
||||||
|
|
||||||
|
# Suppress log files older than one year
|
||||||
|
0 4 * * * root /usr/lib/alternc/delete_logs.sh
|
||||||
|
|
||||||
# Every day at 5am and every week at 4am, make requested SQL backups
|
# Every day at 5am and every week at 4am, make requested SQL backups
|
||||||
0 5 * * * www-data /usr/lib/alternc/sqlbackup.sh -t daily
|
0 5 * * * www-data /usr/lib/alternc/sqlbackup.sh -t daily
|
||||||
0 4 * * 0 www-data /usr/lib/alternc/sqlbackup.sh -t weekly
|
0 4 * * 0 www-data /usr/lib/alternc/sqlbackup.sh -t weekly
|
||||||
|
|
|
@ -102,6 +102,7 @@ var/alternc/mail/z
|
||||||
var/alternc/mla
|
var/alternc/mla
|
||||||
var/alternc/sessions
|
var/alternc/sessions
|
||||||
var/alternc/tmp
|
var/alternc/tmp
|
||||||
|
var/alternc/logs
|
||||||
var/backups/alternc
|
var/backups/alternc
|
||||||
var/log/alternc
|
var/log/alternc
|
||||||
var/run/alternc
|
var/run/alternc
|
||||||
|
|
|
@ -10,8 +10,8 @@ Standards-Version: 3.9.1
|
||||||
Package: alternc
|
Package: alternc
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Pre-depends: debconf (>= 0.5.00) | debconf-2.0
|
Pre-depends: debconf (>= 0.5.00) | debconf-2.0
|
||||||
Depends: debianutils (>= 1.13.1), apache2-mpm-itk, libapache2-mod-php5, php5-mysql, phpmyadmin, postfix, proftpd-mod-mysql, proftpd-basic, squirrelmail, squirrelmail-locales, bind9, wget, rsync, quota, ca-certificates, locales, perl-suid, perl, postfix-mysql, wwwconfig-common, sasl2-bin, fam | gamin, libsasl2-modules, php5-cli, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), sudo, adduser, mysql-client, dnsutils, bash, acl, dovecot-common (>= 1:1.2.15), dovecot-imapd, dovecot-pop3d
|
Depends: debianutils (>= 1.13.1), apache2-mpm-itk, libapache2-mod-php5, php5-mysql, phpmyadmin, postfix, proftpd-mod-mysql, proftpd-basic, squirrelmail, squirrelmail-locales, bind9, wget, rsync, quota, ca-certificates, locales, perl-suid, perl, postfix-mysql, wwwconfig-common, sasl2-bin, fam | gamin, libsasl2-modules, php5-cli, lockfile-progs (>= 0.1.9), gettext (>= 0.10.40-5), sudo, adduser, mysql-client, dnsutils, bash, acl, dovecot-common (>= 1:1.2.15), dovecot-imapd, dovecot-pop3d,vlogger
|
||||||
Recommends: mysql-server(>= 5.0), dovecot-managesieved, dovecot-sieve, dovecot-mysql
|
Recommends: mysql-server(>= 5.0), dovecot-managesieved, dovecot-sieve, dovecot-mysql, ntpdate
|
||||||
Conflicts: alternc-admintools, alternc-awstats (< 1.0), alternc-webalizer (<= 0.9.4), alternc-mailman (< 2.0), courier-authdaemon
|
Conflicts: alternc-admintools, alternc-awstats (< 1.0), alternc-webalizer (<= 0.9.4), alternc-mailman (< 2.0), courier-authdaemon
|
||||||
Provides: alternc-admintools
|
Provides: alternc-admintools
|
||||||
Replaces: alternc-admintools
|
Replaces: alternc-admintools
|
||||||
|
|
|
@ -71,6 +71,9 @@ install: build
|
||||||
done ;\
|
done ;\
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#log directory
|
||||||
|
mkdir -p debian/alternc/var/alternc/logs
|
||||||
|
chown alterncpanel:alterncpanel debian/alternc/var/alternc/logs
|
||||||
# Group and user 1999 reference alterncpanel
|
# Group and user 1999 reference alterncpanel
|
||||||
chown 1999:1999 debian/alternc/var/alternc/html/*
|
chown 1999:1999 debian/alternc/var/alternc/html/*
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
LogFormat "%{LOGIN}e %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" alternc
|
||||||
|
CustomLog "|| /usr/sbin/vlogger -u alterncpanel -g alterncpanel -s access.log /var/alternc/logs" alternc
|
||||||
|
|
||||||
|
#Uncomment the following line to active Buffered Logs (Default: Off)
|
||||||
|
#BufferedLogs On
|
|
@ -7,7 +7,4 @@
|
||||||
|
|
||||||
alias /alternc-sql /usr/share/phpmyadmin
|
alias /alternc-sql /usr/share/phpmyadmin
|
||||||
alias /webmail /usr/share/squirrelmail
|
alias /webmail /usr/share/squirrelmail
|
||||||
|
|
||||||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T %{Host}i" alternc
|
|
||||||
CustomLog /var/log/apache2/access.log alternc
|
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
|
@ -7,6 +7,4 @@
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteRule ^/(.*)$ %%redirect%%/$1 [R=301,L]
|
RewriteRule ^/(.*)$ %%redirect%%/$1 [R=301,L]
|
||||||
|
|
||||||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T %{Host}i" alternc
|
|
||||||
CustomLog /var/log/apache2/access.log alternc
|
|
||||||
</Virtualhost>
|
</Virtualhost>
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName %%fqdn%%
|
ServerName %%fqdn%%
|
||||||
DocumentRoot "%%document_root%%"
|
DocumentRoot "%%document_root%%"
|
||||||
AssignUserId #%%UID%% #%%GID%%
|
AssignUserId #%%UID%% #%%GID%%
|
||||||
|
SetEnv LOGIN "%%UID%%-%%LOGIN%%"
|
||||||
|
|
||||||
<Directory "%%document_root%%">
|
<Directory "%%document_root%%">
|
||||||
php_admin_value open_basedir "%%account_root%%:/usr/share/php/:/var/alternc/tmp:/tmp"
|
php_admin_value open_basedir "%%account_root%%:/usr/share/php/:/var/alternc/tmp:/tmp"
|
||||||
|
@ -11,6 +12,5 @@
|
||||||
AllowOverride AuthConfig FileInfo Limit Options Indexes
|
AllowOverride AuthConfig FileInfo Limit Options Indexes
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T %{Host}i" alternc
|
|
||||||
CustomLog /var/log/apache2/access.log alternc
|
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,4 @@
|
||||||
Options Indexes FollowSymLinks
|
Options Indexes FollowSymLinks
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T %{Host}i" alternc
|
|
||||||
CustomLog /var/log/apache2/access.log alternc
|
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
SETUID=mail_add mail_del quota_edit quota_get mem_add mem_del du.pl
|
SETUID=mail_add mail_del quota_edit quota_get mem_add mem_del du.pl
|
||||||
SCRIPTS=sqlbackup.sh rawstat.daily quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh
|
SCRIPTS=sqlbackup.sh rawstat.daily quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh
|
||||||
LIBS=functions.sh functions_hosting.sh functions_dns.sh
|
LIBS=functions.sh functions_hosting.sh functions_dns.sh
|
||||||
BIN=$(DESTDIR)/usr/lib/alternc/
|
BIN=$(DESTDIR)/usr/lib/alternc/
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
for CONFIG_FILE in \
|
||||||
|
/etc/alternc/local.sh \
|
||||||
|
/usr/lib/alternc/functions.sh
|
||||||
|
do
|
||||||
|
if [ ! -r "$CONFIG_FILE" ]; then
|
||||||
|
echo "Can't access $CONFIG_FILE."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
. "$CONFIG_FILE"
|
||||||
|
done
|
||||||
|
$days=2
|
||||||
|
#parcourir tous les logs pour trouver ceux qui on plus de 2 jours et en faire un tar.
|
||||||
|
find "$ALTERNC_LOC/logs" -not -name '*.gz' -mtime +$days -exec gzip '{}' \;
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
for CONFIG_FILE in \
|
||||||
|
/etc/alternc/local.sh \
|
||||||
|
/usr/lib/alternc/functions.sh
|
||||||
|
do
|
||||||
|
if [ ! -r "$CONFIG_FILE" ]; then
|
||||||
|
echo "Can't access $CONFIG_FILE."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
. "$CONFIG_FILE"
|
||||||
|
done
|
||||||
|
days=366
|
||||||
|
#parcourir tous les logs pour trouver ceux qui on plus de 1 ans et les deletes.
|
||||||
|
find "$ALTERNC_LOC/logs" -mtime +$days -exec rm '{}' \;
|
|
@ -93,6 +93,7 @@ host_create() {
|
||||||
|
|
||||||
# Put the good value in the conf file
|
# Put the good value in the conf file
|
||||||
sed -i \
|
sed -i \
|
||||||
|
-e "s#%%LOGIN%%#$USER#g" \
|
||||||
-e "s#%%fqdn%%#$FQDN2#g" \
|
-e "s#%%fqdn%%#$FQDN2#g" \
|
||||||
-e "s#%%document_root%%#$DOCUMENT_ROOT2#g" \
|
-e "s#%%document_root%%#$DOCUMENT_ROOT2#g" \
|
||||||
-e "s#%%account_root%%#$ACCOUNT_ROOT2#g" \
|
-e "s#%%account_root%%#$ACCOUNT_ROOT2#g" \
|
||||||
|
|
|
@ -19,6 +19,7 @@ umask 022
|
||||||
LOCK_FILE="$ALTERNC_LOC/bureau/cron.lock"
|
LOCK_FILE="$ALTERNC_LOC/bureau/cron.lock"
|
||||||
OLDIFS="$IFS"
|
OLDIFS="$IFS"
|
||||||
NEWIFS=" "
|
NEWIFS=" "
|
||||||
|
LOGFORMAT_FILE="/etc/alternc/apache_logformat.conf"
|
||||||
RELOAD_ZONES="$(mktemp /tmp/alternc_reload_zones.XXXX)"
|
RELOAD_ZONES="$(mktemp /tmp/alternc_reload_zones.XXXX)"
|
||||||
RELOAD_WEB="$(mktemp /tmp/alternc_reload_web.XXXX)"
|
RELOAD_WEB="$(mktemp /tmp/alternc_reload_web.XXXX)"
|
||||||
DNS_DO_RESTART="/tmp/alternc.do_do_restart.$$"
|
DNS_DO_RESTART="/tmp/alternc.do_do_restart.$$"
|
||||||
|
@ -117,13 +118,26 @@ do
|
||||||
echo -n " $dom " >> "$RELOAD_ZONES"
|
echo -n " $dom " >> "$RELOAD_ZONES"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
if [ ! -z "$(cat "$RELOAD_WEB")" ] ; then
|
if [ ! -z "$(cat "$RELOAD_WEB")" ] ; then
|
||||||
echo " apache " >> "$RELOAD_ZONES"
|
echo " apache " >> "$RELOAD_ZONES"
|
||||||
|
|
||||||
# Concat the apaches files
|
# Concat the apaches files
|
||||||
tempo=$(mktemp "$VHOST_FILE.XXXXX")
|
tempo=$(mktemp "$VHOST_FILE.XXXXX")
|
||||||
find "$VHOST_DIR" -mindepth 2 -type f -iname "*.conf" -print0 | xargs -0 cat > "$tempo"
|
|
||||||
|
(
|
||||||
|
echo "###BEGIN OF ALTERNC AUTO-GENERATED FILE - DO NOT EDIT MANUALLY###"
|
||||||
|
# If exists and readable, include conf file "apache_logformat.conf"
|
||||||
|
# contain LogFormat and CustomLog directives for our Vhosts)
|
||||||
|
echo "## LogFormat informations"
|
||||||
|
if [ ! -r "$LOGFORMAT_FILE" ] ; then
|
||||||
|
echo "## Warning : Cannot read $LOGFORMAT_FILE"
|
||||||
|
else
|
||||||
|
echo "Include \"$LOGFORMAT_FILE\""
|
||||||
|
fi
|
||||||
|
find "$VHOST_DIR" -mindepth 2 -type f -iname "*.conf" -print0 | xargs -0 cat
|
||||||
|
echo "###END OF ALTERNC AUTO-GENERATED FILE - DO NOT EDIT MANUALLY###"
|
||||||
|
) > "$tempo"
|
||||||
|
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
log_error " web file concatenation failed"
|
log_error " web file concatenation failed"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue