Thomas Bergheim dot com | Random ramblings on technology

Keeping /tmp contents between boots on Arch

Although dependancy on /tmp is a bad idea, I still want to be able to recover things like OpenOffice and Okular files between boots. You could probably set up where these programs do temporary storage, but this is quicker; open up /etc/rc.inittab anddelete the line “/bin/rm -rf /tmp/* …”.

This works, however old stuff is now never removed, which is bad, so add a new line there, something like “/usr/bin/find /tmp/ -mtime +14 -type f -exec rm -rf {} \; &>/dev/null”. This will make sure files that are over 2 weeks old will be removed.

And since you don’t delete the directory anymore, there are a few mkdir /tmp/… that will give you a warning during boot – just add “-p” to the mkdir arguments and it will be fine.

Back to Top

Write a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>