You are not logged in.

#1 2014-06-04 03:51:49

Salkay
Member
Registered: 2014-05-22
Posts: 417

[SOLVED] Setting deletion age for files in /tmp

Hi, I've just migrated to Arch from (K)ubuntu. In Ubuntu, I had "TMPTIME=1" in /etc/default/rcS. This meant that files in /tmp were deleted (during boot) only if they were older than 1 days.

Is there an equivalent setting in Arch? I couldn't find a pre-existing /etc/default/rcS, nor /etc/init/mounted-tmp.conf, which runs the deletion in Ubuntu.

Last edited by Salkay (2014-06-08 02:04:55)

Offline

#2 2014-06-04 03:54:09

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 7,318

Re: [SOLVED] Setting deletion age for files in /tmp

Since /tmp is on tmpfs by default, they don't survive a reboot.

Offline

#3 2014-06-04 04:04:57

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: [SOLVED] Setting deletion age for files in /tmp

What's your reason for wanting temporary files to not be temporary yet remain in the directory for temporary files?

Offline

#4 2014-06-04 04:07:30

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,413

Re: [SOLVED] Setting deletion age for files in /tmp

The files in /tmp are cleaned periodically by systemd-tmpfiles.{timer,service} though.  So although they won't survive a reboot as Scimmia mentioned, they will also be cleaned out if you leave your system running for a long period of time.

To see what these times are set to, see the man page for systemd-tmpfiles and the /usr/lib/tmpfiles.d/tmp.conf file.

Offline

#5 2014-06-06 16:47:10

Salkay
Member
Registered: 2014-05-22
Posts: 417

Re: [SOLVED] Setting deletion age for files in /tmp

Oh sorry, I just realised I don't get subscribed to my own threads by default (I've just updated my prefs). Thanks for the prompt responses, everyone.

In the past (in Kubuntu), I would use /tmp to store semi-temporary things like short notes, screenshots, short scripts, and downloaded files. I might need these in the short term, for example if I wanted to email a file to someone. For a while, Kubuntu was crashing a lot, and I liked having these files persist just for a little while, to save me time.

I actually quite like Arch's idea of /tmp being cleared out based on time, not just on reboot. Also, since I'm now using Arch surely I'll be crashing a lot less! wink However, since making /tmp persist on reboot seems to be not so simple, I suppose I should just modify my workflow and save these files somewhere else.

Last edited by Salkay (2014-06-06 16:48:01)

Offline

#6 2014-06-06 17:04:55

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,413

Re: [SOLVED] Setting deletion age for files in /tmp

/tmp doesn't neceessarily have to be on a tmpfs.  The file /usr/lib/systemd/system/tmp.mount is what makes it default to that.  But like all unit files, you can override it with your own.  So if you would like to have it on the normal disk, you can do that.  The tmpfiles.d config will still clean it up according to those intervals listed.

Offline

#7 2014-06-06 17:06:31

loqs
Member
Registered: 2014-03-06
Posts: 9,078

Re: [SOLVED] Setting deletion age for files in /tmp

You could use /var/tmp which is not on tmpfs and defaults to 30 days before file removal.

Offline

#8 2014-06-06 17:13:30

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,413

Re: [SOLVED] Setting deletion age for files in /tmp

loqs wrote:

You could use /var/tmp which is not on tmpfs and defaults to 30 days before file removal.

I don't think that /var/tmp is really meant to be used in the same way as /tmp.  I recall seeing advice to not do this...

Offline

#9 2014-06-07 07:12:32

Salkay
Member
Registered: 2014-05-22
Posts: 417

Re: [SOLVED] Setting deletion age for files in /tmp

WonderWoofy wrote:

/tmp doesn't neceessarily have to be on a tmpfs.  The file /usr/lib/systemd/system/tmp.mount is what makes it default to that.  But like all unit files, you can override it with your own.  So if you would like to have it on the normal disk, you can do that.  The tmpfiles.d config will still clean it up according to those intervals listed.

Okay, thanks. I think I'll leave it for the moment. I'll live with the default for the moment. I've already spent tens of hours fiddling with my Arch install!

WonderWoofy wrote:
loqs wrote:

You could use /var/tmp which is not on tmpfs and defaults to 30 days before file removal.

I don't think that /var/tmp is really meant to be used in the same way as /tmp.  I recall seeing advice to not do this...

Ah, that's a pity. It's a good idea in theory, although 30 days is probably too long for me.

Offline

Board footer

Powered by FluxBB