I'm looking for a way to figure out which accounts have not been logged in to in over n days. It occurs to me that, perhaps, the way to do this would be to look at the mtime on one of the dovecot-maintained files, like 'dovecot-uidlist'. Is there a particular file that would be modified on (almost) every login, whether it be via POP or IMAP?
-Ben
-- Ben Beuchler There is no spoon. insyte@emt-p.org -- The Matrix
On 11.10.2004, at 16:39, Ben Beuchler wrote:
I'm looking for a way to figure out which accounts have not been logged in to in over n days. It occurs to me that, perhaps, the way to do this would be to look at the mtime on one of the dovecot-maintained files, like 'dovecot-uidlist'. Is there a particular file that would be modified on (almost) every login, whether it be via POP or IMAP?
Probably best would be to check atime of .INBOX/.imap.index file. dovecot-uidlist isn't necessarily accessed every time. And if nothing has changed in mailboxes, mtime isn't changed from any file.
--On Monday, October 11, 2004 8:19 PM +0300 Timo Sirainen tss@iki.fi wrote:
Probably best would be to check atime of .INBOX/.imap.index file. dovecot-uidlist isn't necessarily accessed every time. And if nothing has changed in mailboxes, mtime isn't changed from any file.
But watch out when you do backups. I'm using dump, which doesn't affect atime, but I do use "restore -C" to verify the tape and that does touch atime. So I temporarily turn off atime on the filesystem while doing the verify.
Example from my verify script:
/bin/mount -o remount,noatime /boot $RESTORE -C -l -L $MAXMISCOMPARES -b $BLOCKING -f $DUMPSUBDIR/boot.dump /bin/mount -o remount,atime /boot
This disables atime updates on the boot partition, verifies the backup for that partition, and then turns the updates back on.
This is precisely so that I can use atime to monitor for dead mailboxes.
On Mon, Oct 11, 2004 at 08:19:37PM +0300, Timo Sirainen wrote:
On 11.10.2004, at 16:39, Ben Beuchler wrote:
I'm looking for a way to figure out which accounts have not been logged in to in over n days. It occurs to me that, perhaps, the way to do this would be to look at the mtime on one of the dovecot-maintained files, like 'dovecot-uidlist'. Is there a particular file that would be modified on (almost) every login, whether it be via POP or IMAP?
Probably best would be to check atime of .INBOX/.imap.index file. dovecot-uidlist isn't necessarily accessed every time. And if nothing has changed in mailboxes, mtime isn't changed from any file.
Unfortunately, I've mounted the filesystem with 'noatime'. However, since I'm only interested in people that haven't logged in in a very long time, mtime of .INBOX/.imap.index would probably suffice.
Thanks!
-- Ben Beuchler There is no spoon. insyte@emt-p.org -- The Matrix
On Mon, 11 Oct 2004, Ben Beuchler wrote:
Unfortunately, I've mounted the filesystem with 'noatime'. However, since I'm only interested in people that haven't logged in in a very long time, mtime of .INBOX/.imap.index would probably suffice.
You could also parse the log files. I think it's quite trivial to check for each user what the last match was of 'imap-login:' (grep | tail -1). That way, you can be sure it really was a login.
Ofcourse, it rather depends on how old your log files are, you might not have anything more than a few weeks old.
I'm looking for a way to figure out which accounts have not been logged in to in over n days. It occurs to me that, perhaps, the way to do this would be to look at the mtime on one of the dovecot-maintained files, like 'dovecot-uidlist'. Is there a particular file that would be modified on (almost) every login, whether it be via POP or IMAP?
The finger command (at least in redhat) looks at teh atime of /var/spool/mail/username You may be able to do somethign similar but it is dependant on using mbox in that dir.
Some filesystems may also be mounted to NOT updated the atime of files (Saves "unnecassary" hard disk writes).
-- Dean Earley AKA Dee (dean@earlsoft.co.uk)
irc: irc://irc.blitzed.org/ web: http://personal.earlsoft.co.uk phone: +44 (0)780 8369596
On Mon, Oct 11, 2004 at 07:50:30PM +0100, Dean Earley wrote:
Some filesystems may also be mounted to NOT updated the atime of files (Saves "unnecassary" hard disk writes).
Heh... That's what I'm doing. It's probably not necessary, though.
-Ben
-- Ben Beuchler There is no spoon. insyte@emt-p.org -- The Matrix
participants (5)
-
Ben Beuchler
-
Dean Earley
-
Kenneth Porter
-
Timo Sirainen
-
Wouter Van Hemel