My ~/.xsession-errors file grows very fast and I'd like to set a limit on its size. How?

link|improve this question

feedback

2 Answers

up vote 4 down vote accepted

You should realy try to solve the problems that cause the file to grow.

link|improve this answer
Sure! But the thing is some packaged applications write their logs there because of some inner issues and it's not my fault :) – o_O Tync Jul 1 '10 at 12:58
@o_O: Then that's the problem you need to solve, not this one. – Ignacio Vazquez-Abrams Jul 1 '10 at 16:10
feedback

One idea is to install a cron job that moves the file away when it grows too large, with a line similar to (untested)

0,31 * * * *  f=$HOME/.xsession.sh; wc -c < $f | perl -lne 'exit ($_ > 1024*1024)' || mv $f $f.bak

See

man 5 crontab

for details.

link|improve this answer
2  
Usually removing/truncating is not a good idea for logs: the application that writes there will still have the file handle opened. So, the file either continues to grow even though it was deleted. There should be a way to tell Xorg to reopen its log files. – o_O Tync Jul 1 '10 at 13:02
Ouch. You're right, Xorg keeps the logfile open, and there doesn't appear to be a signal you can send it to make it reopen its logfile, so my idea doesn't work. – reinierpost Jul 5 '10 at 8:11
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.