[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How to preserve sub-tree in a tmporary directory from been cleaned by tmpreaper?



Hi there,

I am using a tmpreaper to clean up public space on an anonymous FTP
server. Each user has a a public ftp directory:

/var/ftp/pub/$USER

Each user's directory contains a sub-directory "permanent"

/var/ftp/pub/$USER/permanent

This directory is used to keep files or directories which users want to
be on the ftp server permanently.

I would like tmpreaper to clean /var/ftp/pub/
but to skip anything that is located in /var/ftp/pub/*/permanent.

There is --protect  option described in a man file, but it is not
obvious to me (please excuse me my stupidity).

If I use --protext '/var/ftp/pub/ftp/permanent/*' it will preserve files
in permanent but will remove everything in e.g. permanent/new/*. 

from tmpreaper man file

--protect '<shell_pattern>'
... Protect  the files that match the <shell_pattern> from deletion.
This option may be used more than once.  It has  no  one  letter
abbreviation, you must spell out the full word "protect".

If  you do not enclose the <shell_pattern> in single quotes, the
shell will perform the  expansion  before  tmpreaper  reads  its
argument  array.   The  program does not support that syntax, so
you must use single quotes around the glob pattern.

tmpreaper will chdir(2) into  each  of  the  directories  you've
specified   for  cleanup,  and  check  for  files  matching  the
<shell_pattern> there.  It then builds a list of them, and  uses
that to protect them from removal.  For example:

tmpreaper --test --verbose --protect \
 '.X*-{lock,unix{/*,}}' --protect '.ICE-{unix{/*,}}' \
 5d /tmp  # 5 day grace period

Thank you in advance.

-- 
Ivan Teliatnikov                phone: +61 2 9351 2031
F05, Edgeworth David Bld.          fax: +61 2 9351 0184
School of Geosciences           email: ivan@geosci.usyd.edu.au
University of Sydney               www: http://www.geosci.usyd.edu.au
Australia



Reply to: