It turns out that you can set how long to keep stuff in /tmp by setting TMPTIME in /etc/default/rcS to the number of days to keep stuff (I'm going for 7days now).
http://linuxers.org/article/differences-between-tmp-and-vartmp
Apparently you normally should put temp stuff you want to keep a bit longer in /var/tmp [1] but that does not seem to get cleared out regularly.
So I made a weekly cronjob to clean out stuff older than 60 days:
#!/bin/bash days=60 tmpdir=/var/tmp/ find -P ${tmpdir} -type f -mtime +$days -exec su amanica -c "notify-send 'weekly clean ${tmpdir}' 'rm {}'" \; -exec rm {} \; find -P ${tmpdir} -type d -mtime +$days -empty -exec su amanica -c "notify-send 'weekly clean ${tmpdir}' 'rm {}'" \; -exec rm -r {} \;
http://ubuntu-virginia.ubuntuforums.org/showthread.php?t=1524077
[1] http://www.pathname.com/fhs/2.2/fhs-5.15.html
No comments:
Post a Comment