Hello, On Fri, 26 Apr 2013, Carl Hartung wrote:
Carlos E. R. wrote: <snipped>
On Friday, 2013-04-26 at 16:35 +0200, David Haller wrote:
On Fri, 26 Apr 2013, Carlos E. R. wrote:
What is wrong?
Nothing. Works as designed.
Yes, I have already been told that :-)
Well, my point was mostly explaining what those find commands do ;)
The easy way, how I have it setup as well:
==== /etc/fstab ==== tmp /tmp tmpfs nodev,nosuid,noexec 0 0 ====
Yes, but you can not keep large files there. I would instead clean on boot.
So, is there a proposed 'official' solution for this? I have plenty of space available, too, but that isn't the point. It seems just crazy to allow /tmp to fill up and up and up, no end in sight.
Probably adding
====
#!/bin/bash
# make bash handle globbing safely for this usecase
shopt -u nullglob
shopt -s failglob
# split rm's into two globs because of how failglob works[1]
rm -rf /tmp/.*
rm -rf /tmp/*
====
to /etc/init.d/boot.local or whatever can be used equivalently with
systemd.
That of course requires that nothing already needs stuff in /tmp/ at
that point when the above script-fragment is executed. If something
needed it before or needs if after, nor probs. Here, with sysVinit it
would work (but I'm using tmpfs anyway), as I've only got X-related
stuff (directly X, KDE, Orbit, etc.) in there (and tmpfiles from
XEmacs/mutt etc.), i.e. stuff that get's started long after boot.local
has been run (or not at all if I remain in Runlevel 3 and don't start
e.g. mutt/XEmacs ;).
-dnh
[1] it'll emit an error message if ANY glob fails and will NOT execute
the command. One might want to add a '2>/dev/null' because of that
after each of the 'rm -rf GLOB' commands. Not sure if you need
both 'shopt's, but I have normally nullglob set and failglob
unset.
COMMAND null- fail- OUTPUT
glob glob
echo a.* - - a.*
ls a.* - - ls: cannot access a.*: No such file or directory
echo a.* X - <empty>
ls a.* X -