initial commit of file from CVS for smeserver-dovecot on Thu 26 Oct 11:25:44 BST 2023
This commit is contained in:
34
root/etc/e-smith/events/actions/adjust-dovecot
Normal file
34
root/etc/e-smith/events/actions/adjust-dovecot
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
|
||||
# This script just ensure the dovecot service is enabled
|
||||
# if imap or imaps is enabled
|
||||
# It will also entirely disable the dovecot service if both imap,
|
||||
# imaps pop3 and pop3s are disabled
|
||||
|
||||
use esmith::ConfigDB;
|
||||
|
||||
my $c = esmith::ConfigDB->open() or die "Couldn't open Config DB\n";
|
||||
|
||||
my $imap = $c->get('imap');
|
||||
my $imaps = $c->get('imaps');
|
||||
my $pop = $c->get('pop3');
|
||||
my $pops = $c->get('pop3s');
|
||||
my $dovecot = $c->get('dovecot') || $c->new_record('dovecot',
|
||||
{ type => 'service',
|
||||
status => 'enabled'});
|
||||
|
||||
my $imapStatus = $imap->prop('status') || 'enabled';
|
||||
my $imapsStatus = $imaps->prop('status') || 'enabled';
|
||||
my $popStatus = $pop->prop('status') || 'enabled';
|
||||
my $popsStatus = $pops->prop('status') || 'enabled';
|
||||
|
||||
if ($imapStatus eq 'enabled' or $imapsStatus eq 'enabled' or $popStatus eq 'enabled' or $popsStatus eq 'enabled'){
|
||||
$dovecot->set_prop('status', 'enabled');
|
||||
}
|
||||
else{
|
||||
$dovecot->set_prop('status', 'disabled');
|
||||
}
|
||||
|
||||
# also if /etc/pam.d/pop3 exists we unlink it, as it was needed by former e-smith-pop3
|
||||
unlink('/etc/pam.d/pop3');
|
@@ -0,0 +1,2 @@
|
||||
sigusr1
|
||||
sighup
|
Reference in New Issue
Block a user