Compare commits
9 Commits
Author | SHA1 | Date |
---|---|---|
Daniel Berteaud | 6d99639d6d | |
Daniel Berteaud | 3c7d17a2e5 | |
Daniel Berteaud | 432eaa8de8 | |
Daniel Berteaud | e6b501d606 | |
Daniel Berteaud | 52e7d7997c | |
Daniel Berteaud | 8669325555 | |
Daniel Berteaud | c9f983db0d | |
Daniel Berteaud | 3b05c5c5f6 | |
Daniel Berteaud | f9260644a5 |
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
HOME=/root
|
||||
|
||||
LOG=$(/sbin/e-smith/db configuration getprop qpsmtpd Log2Sql || echo 'disabled')
|
||||
|
||||
if [ "$LOG" != "enabled" ]; then
|
||||
|
|
|
@ -5,6 +5,12 @@ my $pass = ${'qpsmtpd'}{'DbPassword'} || 'secret';
|
|||
|
||||
my $dbstruct = `rpm -qd smeserver-qpsmtpd-log2sql | grep smtp_log.sql`;
|
||||
|
||||
my $convertInnoDB = '';
|
||||
foreach my $table qw(messages message_headers message_body rcpts){
|
||||
$convertInnoDB .= "ALTER TABLE $table ENGINE=InnoDB;\n"
|
||||
if (-e "/var/lib/mysql/$db/$table.MYD");
|
||||
}
|
||||
|
||||
$OUT .= <<"END";
|
||||
#! /bin/sh
|
||||
if [ ! -d /var/lib/mysql/$db ]; then
|
||||
|
@ -41,6 +47,10 @@ REPLACE INTO db (
|
|||
'N', 'Y', 'Y');
|
||||
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
USE smtp_log;
|
||||
$convertInnoDB
|
||||
|
||||
EOF
|
||||
END
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
%define version 0.1.4
|
||||
%define version 0.1.8
|
||||
%define release 1
|
||||
%define name smeserver-qpsmtpd-log2sql
|
||||
|
||||
|
@ -23,6 +23,18 @@ Requires: perl(DBI)
|
|||
Log every smtp transaction in a database
|
||||
|
||||
%changelog
|
||||
* Thu Jun 26 2014 Daniel Berteaud <daniel@firewall-services.com> 0.1.8-1
|
||||
- Define HOME in cron task so it works on EL6
|
||||
|
||||
* Wed May 15 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.7-1
|
||||
- Only convert to InnoDB if not already done
|
||||
|
||||
* Mon Apr 22 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.6-1
|
||||
- Fix a typo in MySQL template
|
||||
|
||||
* Fri Apr 19 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.5-1
|
||||
- Use InnoDB instead of MyISAM
|
||||
|
||||
* Tue Oct 16 2012 Daniel Berteaud <daniel@firewall-services.com> 0.1.4-1
|
||||
- purge old entries from the database
|
||||
- log headers in a separate table
|
||||
|
|
|
@ -16,25 +16,25 @@ CREATE TABLE `messages` (
|
|||
`deny_code` int(11) default '0',
|
||||
`deny_msg` text,
|
||||
PRIMARY KEY (`mail_id`)
|
||||
) TYPE=MyISAM;
|
||||
) TYPE=InnoDB;
|
||||
|
||||
CREATE TABLE `rcpts` (
|
||||
`rcpt_id` int(11) NOT NULL auto_increment,
|
||||
`mail_id` varchar(255) NOT NULL default '',
|
||||
`recipient` varchar(255),
|
||||
PRIMARY KEY (`rcpt_id`)
|
||||
) TYPE=MyISAM;
|
||||
) TYPE=InnoDB;
|
||||
|
||||
CREATE TABLE `message_body` (
|
||||
`bdy_id` int(11) NOT NULL auto_increment,
|
||||
`mail_id` varchar(255) NOT NULL default '',
|
||||
`body` text,
|
||||
PRIMARY KEY (`bdy_id`)
|
||||
) TYPE=MyISAM;
|
||||
) TYPE=InnoDB;
|
||||
|
||||
CREATE TABLE `message_headers` (
|
||||
`header_id` int(11) NOT NULL auto_increment,
|
||||
`mail_id` varchar(255) NOT NULL default '',
|
||||
`header` text,
|
||||
PRIMARY KEY (`header_id`)
|
||||
) TYPE=MyISAM;
|
||||
) TYPE=InnoDB;
|
||||
|
|
Loading…
Reference in New Issue