1TMPWATCH(8)              System Administrator's Manual             TMPWATCH(8)
2
3
4

NAME

6       tmpwatch  -  removes  files which haven't been accessed for a period of
7       time
8

SYNOPSIS

10       tmpwatch [-u|-m|-c] [-MUXadfqstvx] [--verbose] [--force] [--all]
11                      [--nodirs] [--nosymlinks] [--test] [--fuser] [--quiet]
12                      [--atime|--mtime|--ctime] [--dirmtime] [--exclude path]
13                      [--exclude-user user] [--exclude-pattern pattern]
14                      time dirs
15
16

DESCRIPTION

18       tmpwatch recursively removes files which haven't been  accessed  for  a
19       given time.  Normally, it's used to clean up directories which are used
20       for temporary holding space such as /tmp.
21
22       When changing directories, tmpwatch is very sensitive to possible  race
23       conditions  and will exit with an error if one is detected. It does not
24       follow symbolic links in the directories it's cleaning (even if a  sym‐
25       bolic  link  is  given  as  its  argument), does not switch filesystems
26       (including non-trivial bind mounts), skips lost+found directories owned
27       by  the  root  user, and only removes empty directories, regular files,
28       symbolic links, and on some systems also unused sockets.
29
30       By default, tmpwatch dates files by  their  atime  (access  time),  not
31       their  mtime (modification time). If files aren't being removed when ls
32       -l implies they should be, use ls -u to examine their atime to  see  if
33       that explains the problem.
34
35       If the --atime, --ctime or --mtime options are used in combination, the
36       decision about deleting a file will be based on the  maximum  of  these
37       times.   The  --dirmtime  option implies ignoring atime of directories,
38       even if the --atime option is used.
39
40       The time parameter defines the threshold for removing  files.   If  the
41       file  has  not  been  accessed for time, the file is removed.  The time
42       argument is a number with an optional single-character suffix  specify‐
43       ing the units: m for minutes, h for hours, d for days.  If no suffix is
44       specified, time is in hours.
45
46       Following this, one or more directories may be given  for  tmpwatch  to
47       clean up.
48
49
50

OPTIONS

52       -u, --atime
53              Make  the  decision  about  deleting  a file based on the file's
54              atime (access time). This is the default.
55
56              Note that the periodic updatedb file system scans keep the atime
57              of directories recent.
58
59
60       -m, --mtime
61              Make  the  decision  about  deleting  a file based on the file's
62              mtime (modification time) instead of the atime.
63
64
65       -c, --ctime
66              Make the decision about deleting a  file  based  on  the  file's
67              ctime (inode change time) instead of the atime; for directories,
68              make the decision based on the mtime.
69
70
71       -M, --dirmtime
72              Make the decision about deleting a directory based on the direc‐
73              tory's  mtime  (modification  time)  instead  of the atime; com‐
74              pletely ignore atime for directories.
75
76
77       -a, --all
78              Remove all file types, not just regular  files,  symbolic  links
79              and  directories.   On  systems where tmpwatch can remove unused
80              sockets, make the decision only based on  file  times,  ignoring
81              possible use of the socket.
82
83
84       -d, --nodirs
85              Do not attempt to remove directories, even if they are empty.
86
87
88       -f, --force
89              Remove  root-owned  files even if root doesn't have write access
90              (akin to rm -f).
91
92
93       -l, --nosymlinks
94              Do not attempt to remove symbolic links.
95
96
97       -q, --quiet
98              Report only fatal errors.
99
100
101       -s, --fuser
102              Attempt to use the "fuser" command to see if a file  is  already
103              open before removing it.  Not enabled by default.   Does help in
104              some circumstances, but  not  all.   Dependent  on  fuser  being
105              installed in /sbin.  Not supported on HP-UX or Solaris.
106
107
108       -t, --test
109              Don't remove files, but go through the motions of removing them.
110              This implies -v.
111
112
113       -U, --exclude-user=user
114              Don't remove files owned by user, which can be an user  name  or
115              numeric user ID.
116
117
118       -v, --verbose
119              Print a verbose display. Two levels of verboseness are available
120              -- use this option twice to get the most verbose output.
121
122
123       -x, --exclude=path
124              Skip path; if path is a directory, all files contained in it are
125              skipped  too.   If  path  does not exist, it must be an absolute
126              path that contains no symbolic links.
127
128
129       -X, --exclude-pattern=pattern
130              Skip paths matching pattern; if a directory matches pattern, all
131              files  contained  in  it are skipped too.  pattern must match an
132              absolute path that contains no symbolic links.
133
134

SEE ALSO

136       cron(1), ls(1), rm(1), fuser(1)
137
138

AUTHORS

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)
Impressum