From: Jonathan McDowell Date: Sun, 5 Jun 2016 20:28:58 +0000 (+0100) Subject: Switch to using mail_dir for incoming mail lock file X-Git-Tag: onak-0.5.0~38 X-Git-Url: http://the.earth.li/gitweb/?p=onak.git;a=commitdiff_plain;h=a183a1f43e77bc96119f60a5b056dd0a489eabe2 Switch to using mail_dir for incoming mail lock file Rather than using the db_dir for the lock file to prevent multiple onak-mail instances processing incoming requests at the same time, use the mail_dir file where the incoming messages are spooled anyway. This is cleaner and will cope with the potential for multiple DB backends to be in play in the future. --- diff --git a/onak-mail.pl.in b/onak-mail.pl.in index 96fce71..097404e 100644 --- a/onak-mail.pl.in +++ b/onak-mail.pl.in @@ -37,8 +37,6 @@ sub readconfig { $config{'mta'} = $1; } elsif (/^pks_bin_dir (.*)/) { $config{'pks_bin_dir'} = $1; - } elsif (/^db_dir (.*)/) { - $config{'db_dir'} = $1; } elsif (/^mail_dir (.*)/) { $config{'mail_dir'} = $1; } elsif (/^syncsite (.*)/) { @@ -223,7 +221,7 @@ rename $tmpfile.".tmp", $tmpfile; # Lock here to ensure that only one copy of us is processing the incoming # mail queue at any point in time. # -sysopen(LOCKFILE, $config{'db_dir'}.'/onak-mail.lck', +sysopen(LOCKFILE, $config{'mail_dir'}.'/onak-mail.lck', O_WRONLY|O_CREAT|O_EXCL) or exit; print LOCKFILE "$$"; close(LOCKFILE); @@ -266,4 +264,4 @@ while ($file = readdir(MAILDIR)) { processmail($subject, $from, $replyto, \%seenby, \@body); } closedir(MAILDIR); -unlink $config{'db_dir'}.'/onak-mail.lck'; +unlink $config{'mail_dir'}.'/onak-mail.lck';