Jump to content

Configuring tmpwatch


seaeagle
 Share

Recommended Posts

Hi all -

 

I have tmpwatch installed on my system, and it is supposed to do a daily clean of the /tmp & /var/tmp folders, removing files not accessed in the past 10 days. When I checked the /etc/cron.daily/tmpwatch file, this is how it was configured:

 

#!/bin/sh

 

[ -f /etc/sysconfig/tmpwatch ] && . /etc/sysconfig/tmpwatch

 

/usr/sbin/tmpwatch $TMPWATCH_EXCLUDES 240 /tmp /var/tmp

 

[ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n

if [ -d /usr/share/man/$LANG/ ] && [ -d /var/catman/$LANG/ ]; then

/usr/sbin/tmpwatch -f 240 /var/catman/{X11R6/cat?,cat?,local/cat?,$LANG/cat?}

else

/usr/sbin/tmpwatch -f 240 /var/catman/{X11R6/cat?,cat?,local/cat?}

fi

I notice that it has "$TMPWATCH_EXCLUDES" before "240 /tmp /var/tmp" - does that mean it is set by default not to work on those 2 folders?

 

As they are the ones I do want to regularly clean, along with my /home/seaeagle/tmp folder, should I change that line to:

 

/usr/sbin/tmpwatch 240 /tmp /var/tmp /home/seaeagle/tmp

I just want to make sure I have things right.

 

Thanks.

Link to comment
Share on other sites

You may want to add --all to also purge otehr objects than files, directories & symlinks (sockets etc). Secondly I have found that some programs access files (I suspect updatedb), meaning that files never get deleted as their access times (by which tmpwatch works) are continuously updated. I usethe --ctime option. See man tmpwatch for details.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...