1TMPWATCH(8) System Administrator's Manual TMPWATCH(8)
2
3
4
6 tmpwatch - removes files which haven't been accessed for a period of
7 time
8
10 tmpwatch [-u|-m|-c] [-MUadfqstvx] [--verbose] [--force] [--all]
11 [--nodirs] [--nosymlinks] [--test] [--fuser] [--quiet]
12 [--atime|--mtime|--ctime] [--dirmtime] [--exclude path]
13 [--exclude-user user] time dirs
14
15
17 tmpwatch recursively removes files which haven't been accessed for a
18 given time. Normally, it's used to clean up directories which are used
19 for temporary holding space such as /tmp.
20
21 When changing directories, tmpwatch is very sensitive to possible race
22 conditions and will exit with an error if one is detected. It does not
23 follow symbolic links in the directories it's cleaning (even if a sym‐
24 bolic link is given as its argument), will not switch filesystems,
25 skips lost+found directories owned by the root user, and only removes
26 empty directories, regular files, and symbolic links.
27
28 By default, tmpwatch dates files by their atime (access time), not
29 their mtime (modification time). If files aren't being removed when ls
30 -l implies they should be, use ls -u to examine their atime to see if
31 that explains the problem.
32
33 If the --atime, --ctime or --mtime options are used in combination, the
34 decision about deleting a file will be based on the maximum of these
35 times. The --dirmtime option implies ignoring atime of directories,
36 even if the --atime option is used.
37
38 The time parameter defines the threshold for removing files. If the
39 file has not been accessed for time, the file is removed. The time
40 argument is a number with an optional single-character suffix specify‐
41 ing the units: m for minutes, h for hours, d for days. If no suffix is
42 specified, time is in hours.
43
44 Following this, one or more directories may be given for tmpwatch to
45 clean up.
46
47
48
50 -u, --atime
51 Make the decision about deleting a file based on the file's
52 atime (access time). This is the default.
53
54 Note that the periodic updatedb file system scans keep the atime
55 of directories recent.
56
57
58 -m, --mtime
59 Make the decision about deleting a file based on the file's
60 mtime (modification time) instead of the atime.
61
62
63 -c, --ctime
64 Make the decision about deleting a file based on the file's
65 ctime (inode change time) instead of the atime; for directories,
66 make the decision based on the mtime.
67
68
69 -M, --dirmtime
70 Make the decision about deleting a directory based on the direc‐
71 tory's mtime (modification time) instead of the atime; com‐
72 pletely ignore atime for directories.
73
74
75 -a, --all
76 Remove all file types, not just regular files, symbolic links
77 and directories.
78
79
80 -d, --nodirs
81 Do not attempt to remove directories, even if they are empty.
82
83
84 -f, --force
85 Remove files even if root doesn't have write access (akin to rm
86 -f).
87
88
89 -l, --nosymlinks
90 Do not attempt to remove symbolic links.
91
92
93 -q, --quiet
94 Report only fatal errors.
95
96
97 -s, --fuser
98 Attempt to use the "fuser" command to see if a file is already
99 open before removing it. Not enabled by default. Does help in
100 some circumstances, but not all. Dependent on fuser being
101 installed in /sbin. Not supported on HP-UX or Solaris.
102
103
104 -t, --test
105 Don't remove files, but go through the motions of removing them.
106 This implies -v.
107
108
109 -U, --exclude-user=user
110 Don't remove files owned by user, which can be an user name or
111 numeric user ID.
112
113
114 -v, --verbose
115 Print a verbose display. Two levels of verboseness are available
116 -- use this option twice to get the most verbose output.
117
118
119 -x, --exclude=path
120 Skip path; if path is a directory, all files contained in it are
121 skipped too. If path does not exist, it must be an absolute
122 path that contains no symbolic links.
123
124
125 -X, --exclude-pattern=pattern
126 Skip paths matching pattern; if a directory matches pattern, all
127 files contained in it are skipped too. pattern must match an
128 absolute path that contains no symbolic links.
129
130
132 cron(1), ls(1), rm(1), fuser(1)
133
134
136 GNU-style long options are not supported on HP-UX.
137
138
140 Erik Troan <ewt@redhat.com>
141 Preston Brown <pbrown@redhat.com>
142 Nalin Dahyabhai <nalin@redhat.com>
143 Miloslav Trmac <mitr@redhat.com>
144
145
146
1474th Berkeley Distribution 2009-10-15 TMPWATCH(8)