last_login using fs:posix does not autocreate the last-login directory
I am using the last_login plug-in on a relatively small system to populate the last access time for users in the directory format. I don't want to have this go into an SQL database or similar as the userbase is small and shell access to the information for other purposes is useful.
I have this in the conf.d directory under the configuration dir in 20-lastlogin.conf:
protocol imap { mail_plugins = $mail_plugins last_login }
plugin { last_login_dict = fs:posix:prefix=/var/run/dovecot/ }
This works except that while the prefix is there the "last-login" directory under the prefix gets removed on restart (as you think it might) and I can't find an example of how to have it auto-created. This results in a bunch of logged errors until I re-create that working directory under the base.
Am I missing something obvious?
Which operating system and init system do you use?
Am Freitag, dem 11.08.2023 um 15:13 +0000 schrieb karl@denninger.net:
I am using the last_login plug-in on a relatively small system to populate the last access time for users in the directory format. I don't want to have this go into an SQL database or similar as the userbase is small and shell access to the information for other purposes is useful.
I have this in the conf.d directory under the configuration dir in 20-lastlogin.conf:
protocol imap { mail_plugins = $mail_plugins last_login }
plugin { last_login_dict = fs:posix:prefix=/var/run/dovecot/ }
This works except that while the prefix is there the "last-login" directory under the prefix gets removed on restart (as you think it might) and I can't find an example of how to have it auto-created. This results in a bunch of logged errors until I re-create that working directory under the base.
Am I missing something obvious?
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
-- Robert Senger
FreeBSD 13 and its normal init (startup script is in /usr/local/etc/rc.d as expected), started at boot or if I have need to stop/restart it later "/usr/local/etc/rc.d/dovecot start" (or "restart", "stop", etc.)
Well, it's not dovecot's responsibility to create non-standard paths. If you require such a path, it's up to you to do this prior to starting dovecot during boot.
On Linux/systemd systems there are a few standard mechanisms to create required directories/files on transient filesystems like /tmp or /run, but I do not know about such a mechanism on FreeBSD.
On FreeBSD, I have created a simple startup script in /usr/local/etc/rc.d/ (see below) which creates extra temporary files and directories and that runs *before* all services (just a few) that require these temporary files. I think this is a better solution than altering the service's startup script, since this will be overwritten during updates/upgrades.
There are quite a few ports on FreeBSD that have startup scripts not doing well with preparing or cleaning up...
Robert
#!/bin/sh
# PROVIDE: tmpfiles # REQUIRE: FILESYSTEMS # BEFORE: squid ...
. /etc/rc.subr
name=tmpfiles rcvar=tmpfiles_enable
start_cmd="${name}_start" stop_cmd=":"
load_rc_config $name : ${maketemp_enable:=no} : ${maketemp_msg="Nothing started."}
tmpfiles_start() { # squid mkdir /var/run/squid chown squid:squid /var/run/squid touch /var/run/squid/squid.pid chown squid:squid /var/run/squid/squid.pid
...
}
run_rc_command "$1"
Am Samstag, dem 12.08.2023 um 19:21 +0000 schrieb karl@denninger.net:
FreeBSD 13 and its normal init (startup script is in /usr/local/etc/rc.d as expected), started at boot or if I have need to stop/restart it later "/usr/local/etc/rc.d/dovecot start" (or "restart", "stop", etc.)
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
-- Robert Senger
I have it in the system's boot script in /etc/rc.local and that works, but if I stop and restart it (e.g. during a package upgrade) that doesn't get run, obviously. I can edit the startup script for dovecot itself but as you noted that might get overwritten during an upgrade.
If the plugin doesn't have a "make it if its not there" option then it doesn't, but there are examples of other things that do (e.g. designating mailboxes for spam, etc.) so it seemed that perhaps it should be there in this case but I didn't find evidence of it in the documentation.
I'll work around it since the answer appears to be "nope, it isn't there."
participants (2)
-
karl@denninger.net
-
Robert Senger