* 2020-10-26 20:04:55+03, Reco wrote:
> On Mon, Oct 26, 2020 at 06:35:45PM +0200, Teemu Likonen wrote:
>> - Do you configure some rotating system, perhaps with logrotate(8)?
>> (Why doesn't Debian have this automatically?)
>
> For Debian, it may work. For RHEL, for instance, such logrotate policy
> would be denied by SELinux.
> That, and inviting running-as-root logrotate to cleanup user files opens
> all kinds of trouble.
I'm using KDE Plasma desktop and my .xsession-errors grows quite fast.
I'll probably write some rotation system for the file. So far the
simplest seems to be adding /etc/logrotate.d/my-xession-errors with
contents like below. Logrotate uses the same owner and permissions as
the original file. Nothing else is needed.
/home/*/.xsession-errors {
rotate 3
monthly
compress
notifempty
}
Logrotate could be used as normal user. For my personal system it's
probably too complicated for such a small thing but there could be
configuration file like this:
# Xsession-logrotate.conf
~/.xsession-errors {
rotate 3
monthly
compress
notifempty
}
Xsession script could run a command like this:
/usr/sbin/logrotate \
--state "$HOME/.local/var/lib/logrotate/status" \
/etc/X11/Xsession-logrotate.conf
On the other hand all this is probably too complicated because the
.xsession-errors file is not that interesting. People have small
additions in their /etc/X11/Xsession script: delete the file every time
or move the old file to ".old". That would be good enough, I think.
--
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450
Attachment:
signature.asc
Description: PGP signature