Web lists-archives.com

Re: How to redirect messages in ~/.xsession-errors to a FIFO device?

On Fri, 06 Apr 2018, Mikhail Morfikov wrote:
> Basically, all messages returned by X-applications are redirected to the
> ~/.xsession-errors file. 
> Unfortunately, the ~/.xsession-errors file grows in size, and after a
> few hours it's around 20-30 MiB, and the content of the file isn't removed with
> each X session restart.

I personally do this:

DATE=$(date "+%Y%m%d_%H%M%S")
# track xsession errors
mv ~/.xsession-errors ~/.xsession-errors_${DATE};
ln -sf ~/.xsession-errors_${DATE} ~/.xsession-errors-current;
# delete old xsession error files
find ~/ -maxdepth 1 -mindepth 1 -type f \
    -iname '.xsession-errors_*' -ctime +30 -delete;

in my .xsession.[1]

> Is it even possible to redirect the content of the file to the FIFO device in
> this way?

The general way to do this is to do re-exec the shell with different
output options, something like this:

exec > /dev/log-xsession-errors 2>&1;

in your .xsession [or whatever you're using to start things] after
testing that the FIFO works.

1: https://git.donarmstrong.com/x_base.git/b/.xsession
Don Armstrong                      https://www.donarmstrong.com

I may not have gone where I intended to go, but I think I have ended
up where I needed to be.
 -- Douglas Adams _The Long Dark Tea-Time of the Soul_