This question is about Ubuntu 14.10 on my developer laptop.
I've got a folder in /tmp
that is used by an application to put temporary stuff in there. This application usually makes a temporary folder in my homedir and deletes it afterwards. For some reason that doesn't work when the homedir is encrypted. So instead, I made a symlink to /tmp/foo
inside my homedir. My application can write there and make it's temporary subfolder.
Now /tmp/foo
gets deleted every time I reboot my machine. Until now I've just recreated the folder manually after reboot. Now I learned in How is the /tmp directory cleaned up? that there is a job doing that.
I've looked at /etc/init/mounted-tmp.conf
but my bashfu and especially my findfu are not sufficient to do what I want. Here's an excerpt from that file:
EXCEPT='! -name . ! ( -path ./lost+found -uid 0 ) ! ( -path ./quota.user -uid 0 ) ! ( -path ./aquota.user -uid 0 ) ! ( -path ./quota.group -uid 0 ) ! ( -path ./aquota.group -uid 0 ) ! ( -path ./.journal -uid 0 ) ! ( -path ./.clean -uid 0 ) ! ( -path "./...security*" -uid 0 )'
Remove all old files, then all empty directories
find . -depth -xdev $TEXPR $EXCEPT ! -type d -delete find . -depth -xdev $DEXPR $EXCEPT -type d -empty -delete
What I want to do is add a condition that makes it delete everyting inside /tmp/foo
, but not /tmp/foo
itself. How do I do that?
/tmp/foo
a directory or a file? – terdon Jun 12 '15 at 14:38mkdir /tmp/foo
right beforeend script
? – Hagen von Eitzen Jun 12 '15 at 16:07