Gentoo Archives: gentoo-user

From: waltdnes@××××××××.org
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Delete /tmp content
Date: Fri, 15 Jul 2016 17:49:09
Message-Id: 20160715174859.GA12309@waltdnes.org
In Reply to: [gentoo-user] Delete /tmp content by Hogren
1 On Fri, Jul 15, 2016 at 01:43:34PM +0200, Hogren wrote
2 > Hello everybody !
3 >
4 > After several strange problems, I discovered that my /tmp content was
5 > never deleted.
6 >
7 > Is there a natif mechanism (with fstab or other option) and it's just a
8 > misconfiguration or there isn't, and I need to use a systemd service ?
9 >
10 > Thanks for your responses !!
11
12 A cron job is the simplest way. Have cron run the command...
13
14 find /tmp -mtime +9 -execdir rm -rf {} \;
15
16 ...every day. "-mtime" (number of days ago the file was last modified)
17 truncates fractions, so +9 (i.e. greater than 9 days) means *AT LEAST
18 10 DAYS*. If you want to delete all old files by all users, including
19 root, the command would have to be run as root.
20
21 --
22 Walter Dnes <waltdnes@××××××××.org>
23 I don't run "desktop environments"; I run useful applications