Try harder to restart ldap, if it's failing

In case it won't restart, restart all zimbra services, prevents mailboxd going crasy and filling GB of logs about not being able to contact LDAP
master
Daniel Berteaud 5 years ago
parent ba36653cd4
commit 2592b82c31
  1. 17
      zmbh/zmbh.pl

@ -101,7 +101,24 @@ if ( $opt->{pre} ) {
log_info("No service were shutted down");
} elsif ($opt->{shutdown} eq 'ldap' and -e '/opt/zimbra/bin/ldap'){
log_info("Starting Zimbra LDAP service");
my $try = 0;
my $running = 0;
while ($try < 20) {
system("/opt/zimbra/bin/ldap start");
sleep 1;
if (system("/opt/zimbra/bin/ldap status") == 0){
$running = 1;
last;
} else {
log_info('ldap service not running, trying again to start it');
$try++;
}
}
# Couldn't start ldap ? Restart all the services
if (not $running){
log_info("Failed to restart ldap, restarting all Zimbra services");
system('systemctl restart zimbra');
}
} else {
log_info("Starting Zimbra services");
system('systemctl start zimbra');

Loading…
Cancel
Save