View Full Version : Fedora tmpwatch flags don't make sense to me
marko
11th March 2009, 12:06 AM
I have a large bunch of keyring dirs in /tmp in F11 rawhide, going all the back to Dec 29.
I was wondering why because I thought tmpwatch was supposed to clean those out, at least long before two and a half months. When I look in the cron.daily tmpwatch I see this:
flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix 10d /tmp
..... (remainder of code excluded)
this doesnt make sense to me because the flags u, m, and c are mutually exclusive, telling the tmpwatch to use either atime, mtime or ctime. Why is the script telling it to use all those?
Anyway, the only way I see to get rid of unused keyring dirs is to use the -a option but is there something bad about doing that?
marcrblevins
11th March 2009, 05:35 AM
That looks different. Here is my copy, I did not change it. You are missing the one for 30 days limit.
[marc@kiriyamablevins cron.daily]$ cat tmpwatch
#! /bin/sh
flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix 10d /tmp
/usr/sbin/tmpwatch "$flags" 30d /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
if [ -d "$d" ]; then
/usr/sbin/tmpwatch "$flags" -f 30d "$d"
fi
done
[marc@kiriyamablevins cron.daily]$
marko
12th March 2009, 05:10 PM
I didn't quote the whole file, the part after the section I quoted made sense to me so I left it off.
I've edited my original to make that clearer.
lmgutie
10th April 2009, 06:13 PM
I see something similar here.
The man pages explain why the script can use "-umc":
"If the --atime, --ctime or --mtime options are used in combination, the
decision about deleting a file will be based on the maximum of these
times."
Also, it looks like your problem is that according to man pages:
"only removes empty directories,"
So you may need to add the "-a" flag.
Test from the command line before changing the script adding the "-t" flag.
marko
10th April 2009, 11:10 PM
Much better, I made the flags umca and increased the first time from 10d to 20d, now I don't have all those keyrings hanging around forever.
thanks
bg3075
24th May 2009, 09:32 PM
That looks different. Here is my copy, I did not change it. You are missing the one for 30 days limit.
[marc@kiriyamablevins cron.daily]$ cat tmpwatch
#! /bin/sh
flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix 10d /tmp
/usr/sbin/tmpwatch "$flags" 30d /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
if [ -d "$d" ]; then
/usr/sbin/tmpwatch "$flags" -f 30d "$d"
fi
done
[marc@kiriyamablevins cron.daily]$
marc,
does your tmpwatch file clean your /tmp directory automatically, or did you have to do something to initiate it as well (mine displays the same thing as yours, but I am not sure if it has cleaned /tmp yet)? It looks like it should clean /tmp every ten days, right?
marko
24th May 2009, 10:11 PM
marc,
does your tmpwatch file clean your /tmp directory automatically, or did you have to do something to initiate it as well (mine displays the same thing as yours, but I am not sure if it has cleaned /tmp yet)? It looks like it should clean /tmp every ten days, right?
Hi,
The tmpwatch script is run daily from /etc/cron.daily/tmpwatch by crond.
At that time, it removes any files and directories that fulfil the requirements
set by the 'flags' variable in the /etc/cron.daily/tmpwatch file and the
arguments on the /usr/sbin/tmpwatch command itself, which is in mine is set up:
(note that I've modified my ##d values and 'flags' options a bit)
/etc/cron.daily/tmpwatch
flags=-umca
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix 20d /tmp
/usr/sbin/tmpwatch "$flags" 30d /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
if [ -d "$d" ]; then
/usr/sbin/tmpwatch "$flags" -f 30d "$d"
fi
done
So that will remove dirs and files under /tmp older than 20 days except those various hidden dirs set by the -x options then the stuff under /var/tmp older than 30 days and then that complicated mix of stuff under /var/cache/{man,catman} at 30days and older
I'm still a bit confused on how cron/anacron works in F11 because I've just noticed that the default /etc/crontab is empty of entries and although my /etc/anacrontab has entries I have anacrond turned off. When I run chkconfig --list | grep cron I don't see anacrond as a service anymore but I do see crond is on. BUT my various cron stuff does happen so I'm sure this is working (I see the disk light go active and if I look at the process list I'll see updated and makewhatis are running) but apparently the cron setup got recently changed in rawhide.
bg3075
24th May 2009, 11:00 PM
Hey thanks, Mark.
I did read that tmpwatch may leave empty folders, unless put in a flag to remove them. This may be what is going on with mine. I see you added an "a" to the flags, "flags=-umca". That is to delete all directories/files, right?
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.