Hi... I wondered if it were possible to create a /etc/cleanuptmp.d/ directory and place a script per program (for these which require bootup tmp cleaning) there. As it is now, /etc/init.d/bootmisc contains a lot of static rm commands to remove now-invalid stuff from tmp on (re)boot (.X0-lock, ...). It would be better if these commands would be in the middle of the bootmisc script but in an external script. Also seperation which rm commands are for what package would be good. So I propose for example: /etc/cleanuptmp.d/X: rm -f /tmp/.X[0-9]* /etc/cleanuptmp.d/esound: rm -f /tmp/.esd* /etc/cleanuptmp.d/ORBit2: rm -f /tmp/orbit-* and so on /etc/init.d/bootmisc would do: if [ -d "/etc/cleanuptmp.d" ] then for s in /etc/cleanuptmp.d/* do if [ "${s%*~}" = "$s" -a -s "$s" ] then # no ~ at end, and not empty source "$s" fi done fi (or put that in a nice external script like /sbin/cleanup-tmp and call it from bootmisc) Or you could do it for all kinds, not just tmp, also for /var/lock, /var/run, whatever... Tell me what you think... Reproducible: Always Steps to Reproduce:
btw I am messing with tmp cleaning since I am searching for the culprit of removing my empty /* directories like /sys /mnt /boot everytime ... hence I'm cleaning up any wildcard and/or -r rm commands, and thought why don't split the rm commands in a way comprehensible to the user (i.e. one file per package) :)
regardless of your motivations, i think this is a great idea ... i dont like the name in /etc/, but i like the idea :)
ok what about /etc/cleanstart.d/ :)
I think it would be particulary easy to implement. Even I could do it, and I will :) probably something along the lines of: tmpclean.eclass: tmpclean_pkg_postinst() { if [ ! -z "${TMPCLEAN_FILES}" ] then mkdir -p /etc/cleantmp.d insinto /etc/cleantmp.d for s in ${TMPCLEAN_FILES} do newins "${s}" done fi } and in each ebuild that installs stuff that has tmpfiles, set TMPCLEAN_FILES to the script to do the cleaning. What do you think ?
and the stuff for bootmisc: if [ -d "/etc/cleantmp.d" ] then for s in "/etc/cleantmp.d/"* do if [ "$s" = "${s%*~}" ] then # no backup source "$s" fi done fi
bootmisc tmpclean is finished and ready, so why not pick it up into baselayout ? *reminder* :)
*** Bug 21445 has been marked as a duplicate of this bug. ***
*** Bug 54083 has been marked as a duplicate of this bug. ***
*** Bug 39387 has been marked as a duplicate of this bug. ***
*** Bug 42589 has been marked as a duplicate of this bug. ***
I fail to see why we can't do things properly and clear out *everything* from /tmp like every other distro. I would like to see this feature without using ram-eating tmpfs. It angers me how many alsa, cups, keyring, gconf, and acroread files there are over time. Having these lists sourced from separate ".d" files will just slow my bootup down even more.
*** Bug 94905 has been marked as a duplicate of this bug. ***
vote for just flat out cleaning /tmp properly from me :) regardless of this cleanup.d fluffy thing.
Re: comment 14 ... I, for one, wholeheartedly concur.
Created attachment 60547 [details] bootmisc here is a new bootmisc script which has the option to wipe /tmp just set WIPE_TMP="yes" in /etc/conf.d/bootmisc can people test and make sure it works before i commit ?
I've tested it with baselayout 1.11.12-r4, no problems.
works for me
This is how osx does it: if [ -d /tmp ]; then cd /tmp && { find . -fstype local -type f -atime +3 -ctime +3 -exec rm -f -- {} \; find -d . -fstype local ! -name . -type d -mtime +1 -exec rmdir -- {} \; \ >/dev/null 2>&1; } fi
Why no progress on this bug? Although an atime cronjob potentially might, in pathological cases, cause problems, what's wrong with rm -rf /tmp/* at boot like tigger said? Are there any known problems with doing this? If the answer is "I don't know"... well, I've been mounting /tmp as tmpfs for a long time and not a single thing has ever gone wrong with it :-)
you clearly need to re-read the bug
added to baselayout svn
*** Bug 99630 has been marked as a duplicate of this bug. ***
What about configurable cleaning of /tmp? Why not provide the option to those who want to?
that's already possible, read the config file
I meant fully configurable, as suggested above (/etc/cleanup.d) not just the predefined patterns or complete wipe
well you can simply copy & paste that into your local files i dont believe it'd be used heavily enough to warrant inclusion
last time I checked, almost every package put some weird temporary files in /tmp/, /var/run/ (bad!), /var/lock/, ${HOME}/, ${HOME}/tmp/, ${HOME}/.gnome2/ or any other unknown location. If you believe you can automate that rather than have the package itself include a temp cleaner (after all, the package would _know_ the actual temp file names), be my guest. I for one don't believe that. That said, current bootmisc is a good start nevertheless. Thanks.
if packages are using those directories incorrectly, file a bug about it