#!/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 # and imaps 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 $dovecot = $c->get('dovecot') || $c->new_record('dovecot', { type => 'service', status => 'enabled'}); my $imapStatus = $imap->prop('status') || 'enabled'; my $imapsStatus = $imaps->prop('status') || 'enabled'; if ($imapStatus eq 'enabled' or $imapsStatus eq 'enabled'){ $dovecot->set_prop('status', 'enabled'); } else{ $dovecot->set_prop('status', 'disabled'); }