Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

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

share|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 :) –  kolypto 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
add comment

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.

share|improve this answer
3  
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. –  kolypto 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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