[Dovecot] Fix imapsync_cron

master
andryyy 2020-03-20 18:11:24 +01:00
parent 2b1ff6c9a3
commit 632d1cabb3
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
2 changed files with 4 additions and 2 deletions

View File

@ -12,7 +12,7 @@ use sigtrap 'handler' => \&sig_handler, qw(INT TERM KILL QUIT);
sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s }; sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s };
my $t = Proc::ProcessTable->new; my $t = Proc::ProcessTable->new;
my $imapsync_running = grep { $_->{cmndline} =~ /imapsync\s/i } @{$t->table}; my $imapsync_running = grep { $_->{cmndline} =~ /imapsync\s/i } @{$t->table};
if ($imapsync_running gt 1) if ($imapsync_running ge 1)
{ {
print "imapsync is active, exiting..."; print "imapsync is active, exiting...";
exit; exit;
@ -44,6 +44,8 @@ $dbh = DBI->connect($dsn, '__DBUSER__', '__DBPASS__', {
mysql_auto_reconnect => 1, mysql_auto_reconnect => 1,
mysql_enable_utf8mb4 => 1 mysql_enable_utf8mb4 => 1
}); });
$dbh->do("UPDATE imapsync SET is_running = 0");
sub sig_handler { sub sig_handler {
# Send die to force exception in "run" # Send die to force exception in "run"
die "sig_handler received signal, preparing to exit...\n"; die "sig_handler received signal, preparing to exit...\n";

View File

@ -188,7 +188,7 @@ services:
- sogo - sogo
dovecot-mailcow: dovecot-mailcow:
image: mailcow/dovecot:1.114 image: mailcow/dovecot:1.115
depends_on: depends_on:
- mysql-mailcow - mysql-mailcow
dns: dns: