where:
enabled: y
order_by: alias
- canonical:
- file: canonical
- description: 'Canonical Mappings'
- enabled: 1
- db_type: hash
- text_type: map
- resultset: Canonical
- columns:
- - email
- - destination
- where:
- enabled: y
- order_by: email
- mydomains:
- file: mydomains
- description: 'Alle lokalen (echten) Domänen'
- enabled: 1
- db_type: hash
- text_type: map
- resultset: Domain
- columns:
- - domain
- - domain
- where:
- type: local
- enabled: y
- order_by: domain
- recipient_bcc:
- file: recipient_bcc
- description: 'BCC-Zuordnungen zu lokalen Empfängern'
- enabled: 1
- db_type: hash
- text_type: map
- resultset: RecipientBcc
- columns:
- - email
- - destination
- where:
- enabled: y
- order_by: email
- relay_domains:
- file: relay_domains
- description: 'Alle Relay-Domänen'
- enabled: 1
- db_type: hash
- text_type: map
- resultset: Domain
- columns:
- - domain
- - domain
- where:
- type: relay
- enabled: y
- order_by: domain
relocated:
file: relocated
description: 'Alle relocatet Mailadressen'
where:
enabled: y
order_by: email
- sender_bcc:
- file: sender_bcc
- description: 'BCC-Zuordnungen zu lokalen Sendern'
- enabled: 1
- db_type: hash
- text_type: map
- resultset: SenderBcc
- columns:
- - email
- - destination
- where:
- enabled: y
- order_by: email
- virtual_alias_domains:
- file: virtual_alias_domains
- description: 'Virtuelle Alias-Domänen'
- enabled: 1
- db_type: hash
- text_type: map
- resultset: Domain
- columns:
- - domain
- - domain
- where:
- type: valias
- enabled: y
- order_by: domain
virtual_alias_maps:
file: virtual_alias_maps
description: 'Virtuelle Alias-Mappings'
where:
enabled: y
order_by: email
- virtual_mailbox_domains:
- file: virtual_mailbox_domains
- description: 'Virtuelle Mailbox-Domänen'
- enabled: 1
- db_type: hash
- text_type: map
- resultset: Domain
- columns:
- - domain
- - domain
- where:
- type: vmbox
- enabled: y
- order_by: domain
- virtual_mailbox_maps:
- file: virtual_mailbox_maps
- description: 'Virtuelle Mailbox-Mappings'
- enabled: 1
- db_type: hash
- text_type: map
- resultset: User
- columns:
- - email
- - maildir
- where:
- enabled: y
- postfix: y
- order_by: email
#-------------------------
-=head2 restart_postfix
+=head2 reload_postfix
-Soll nach dem Mapping Postfix neu gestartet werden?
+Soll nach dem Mapping Postfix neu geladen werden?
=cut
-has 'restart_postfix' => (
+has 'reload_postfix' => (
is => 'rw',
isa => 'Bool',
traits => [ 'NoGetopt' ],
lazy => 1,
- builder => '_build_restart_postfix',
- documentation => 'Soll nach dem Mapping Postfix neu gestartet werden?',
+ builder => '_build_reload_postfix',
+ documentation => 'Soll nach dem Mapping Postfix neu geladen werden?',
);
#------
-sub _build_restart_postfix {
+sub _build_reload_postfix {
return 0;
}
}
if ( $self->verbose >= 2 ) {
- for my $key qw( postfix_dir work_dir postfix_binary postfix_maps restart_postfix valid_maptypes ) {
+ for my $key qw( postfix_dir work_dir postfix_binary postfix_maps reload_postfix valid_maptypes ) {
my $tmp = $self->$key;
}
}
}
$m->{'db_type'} = $type;
$m->{'exec_map'} = $self->valid_maptypes->{$type}{'exec_map'};
- $m->{'restart_postfix'} = $self->valid_maptypes->{$type}{'restart'};
+ $m->{'reload_postfix'} = $self->valid_maptypes->{$type}{'restart'};
}
# Texttyp festlegen
for my $m ( @{ $self->postfix_maps } ) {
$self->do_mapping($m);
}
+ $self->do_reload_postfix();
}
else {
$self->info( "Keine Map-Dateien zu erstellen." );
#---------------------------------
+=head2 do_reload_postfix( )
+
+Versucht, bei Notwendigkeit Postfix neu zu laden
+
+=cut
+
+sub do_reload_postfix {
+
+ my $self = shift;
+
+ $self->debug( sprintf( "Versuche Reload von Postfix ..." ) ) if $self->verbose >= 2;
+ return unless $self->reload_postfix;
+
+ my $cmd = $self->postfix_binary->{'postfix'};
+ my @Args = ( $cmd, "reload" );
+ my $cmdstr = join( " ", @Args );
+
+ $self->info( "Reload von Postfix" );
+ $self->debug( sprintf( "Reload von Postfix mit dem Kommando: '%s'", $cmdstr ) );
+
+ if ( $> != 0 ) {
+ $self->info( "Nur root darf Postfix reloaden." );
+ return 1;
+ }
+
+ unless ( $$self->testmode ) {
+ unless ( system(@Args) == 0 ) {
+ $self->error( sprintf( "Fehler beim Ausführen von '%s'.", $cmdstr ) );
+ exit 11;
+ }
+ }
+
+ return 1;
+
+}
+
+#---------------------------------
+
=head2 do_mapping( $map )
Führt das eigentliche Mapping aus.
}
}
- $self->restart_postfix(1) if $map->{'restart_postfix'};
+ $self->reload_postfix(1) if $map->{'reload_postfix'};
}