This source http://www.daniloaz.com/en/how-to-preve ... huge-size/ says there should be a mechanism in /etc/X11/Xsession to truncate or start a new one on every reboot but I can see on my system that there isn't. I reboot every day but the last .xsession-errors grew up to 7,7 GB when I deleted it. I remember I had more than 15 GB in the past due to an amok running app. I ran out of space because of my special setup but the ever-growing .xsession-errors could really screw up systems with a one-partition-only setup. There should be a mechanism to regularly truncate .xsession-errors.
I'm not good at scripting so I might read /etc/X11/Xsession wrong but I don't see any truncating mechanism there.
Footnote: One of the reasons you should never have /home, the standard location of that file, on your root partition. Especially if you never reboot. It's a long known problem.
For anybody affected reading this from the world wide web - ignore other peoples rants about rm'ing, chown'ing or hacking and slashing at that file - I'm posting the solution we came up with here to spare you to read through our long discussion:
Code: Select all
#!/bin/bash # Truncate .xsession-errors if larger than n MB (MAX_MB) # Backup last n lines (LEAVE_LINES: set to 0 to skip backup) # Check every n minutes (INTERVAL_MIN) MAX_MB=500 LEAVE_LINES=10000 INTERVAL_MIN=60 LOG="$HOME/.xsession-errors" while true; do LOG_BYTES=$(stat --printf=%s "$LOG") MAX_BYTES=$((MAX_MB*1000000)) if (( $LOG_BYTES > $MAX_BYTES )); then if (( $LEAVE_LINES > 0 )); then tail -n $LEAVE_LINES "$LOG" > "$LOG.bak"; fi truncate -s 0 "$LOG" fi sleep $((INTERVAL_MIN*60)) done
Code: Select all
[Desktop Entry] Name=Xsession Errors Log Control Comment=Limit the xsession-errors file size Exec=$HOME/bin/xsession-logcontrol Type=Application StartupNotify=false Terminal=false