I'm trying to receive a "Disconnected" message in my logfile for the connected imap-clients when I restart dovecot. When you disconnect a client, you receive the following message in your log: Mar 12 21:45:55 mail dovecot: IMAP(mailbox at domain.com): Disconnected: Logged out bytes=7496/22441 When a IMAP client is connected and Dovecot is restarted, this message is not shown. This should be solvable by a script like this: #!/bin/sh unset LOG_TO_MASTER export USE_SYSLOG=1 exec /usr/lib/dovecot/imap But this logs the user that runs the script into the imap server and when I terminate this terminal I get a "Disconnected" message for the local linux user, which I don't need of course. Is there a way to get to what I want ? I want to log my IMAP statics for every day and I need to "disconnect" my imap clients for it in some way to receive the Disconnected message and count from there. Thanks.
On Thu, 2009-03-12 at 21:50 +0100, RutgerM wrote:> #!/bin/sh > unset LOG_TO_MASTER > export USE_SYSLOG=1 > exec /usr/lib/dovecot/imap > > But this logs the user that runs the script into the imap server and when > I terminate this terminal I get a "Disconnected" message for the local > linux user, which I don't need of course.I don't really understand what you mean by this. It should log everything the exact same way, except directly to syslog.> Is there a way to get to what I want ? I want to log my IMAP statics for > every day and I need to "disconnect" my imap clients for it in some way to > receive the Disconnected message and count from there.Actually I just realized there is a simple way: killall imap -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20090312/3e94eeb9/attachment-0002.bin>
> On Thu, 2009-03-12 at 21:50 +0100, RutgerM wrote: >> #!/bin/sh >> unset LOG_TO_MASTER >> export USE_SYSLOG=1 >> exec /usr/lib/dovecot/imap >> >> But this logs the user that runs the script into the imap server and >> when >> I terminate this terminal I get a "Disconnected" message for the local >> linux user, which I don't need of course. > > I don't really understand what you mean by this. It should log > everything the exact same way, except directly to syslog.This is not happening indeed. I get a IMAP screen where I can do LIST commands and so on. This happens when I execute imap.>> Is there a way to get to what I want ? I want to log my IMAP statics for >> every day and I need to "disconnect" my imap clients for it in some way >> to >> receive the Disconnected message and count from there. > > Actually I just realized there is a simple way: > > killall imap >This solution also works great indeed. But I still would like to know why the exec way doesn't work.