cltrash

Package: WA2L/edrc 1.5.57
Section: General Commands (1)
Updated: 18 September 2006
Index Return to Main Contents

 

NAME

cltrash - tidy up global trash and *.TRASHED files

 

SYNOPSIS

edrc/bin/cltrash [ -h ]

cltrash -a purge [ -d days ]

cltrash -a remove [ -d days ] [ -r rootdir ]

 

AVAILABILITY

WA2L/edrc

 

DESCRIPTION

The cltrash command is used to tidy up the global trash and the file systems after the use of the trash command.

To tidy up the global trash properly the cltrash command supports two actions:

purge
purge (remove) files which where trashed a certain number of days ago from the trash.

remove
remove the filename.TRASHED "information and instruction files" which are generated a certain number of days ago from the system.

Therefore the
cltrash command has to be started once to purge the global trash with the purge action and once on each system participating on the global trash with the remove action to remove the related "information and instruction files" from the system. If you don't, the user thinks that a file can still be retrieved from the trash, even it has been purged or a trashed file still uses disk space even if the "information and instruction file" does not exist and the user has no hint any more that the file could still be retrieved.

 

OPTIONS

-h
usage message.

-a purge
purge (remove) files which where trashed a number of days, optionally to be specified with the -d option, ago from the trash.

-a remove
remove the filename.TRASHED "information and instruction files" which are generated a number of days, optionally to be specified with the -d option, ago from the system.

-d days
number of days. If not specified this option defaults to 30 days.

-r rootdir
start dir to search for filename.TRASHED files on the system. If not specified this option defaults to /.

 

EXIT STATUS

0
no error.

1
LOGDIR or TRASHDIR does not exist. See trash.cfg(4) if you get this error.

2
operating system is not supported. See osid(3) if you get this error.

3
rootdir does not exist.

4
usage listed.

6
configuration file edrc/etc/trash.cfg does not exist.

 

FILES

edrc/etc/trash.cfg
configuration file for trash, untrash and cltrash.

edrc/var/trash/log/
default logfile location of trash , untrash and cltrash.

edrc/var/trash/files/
default location for trashed files.

filename.TRASHED
information and instruction file to document the file trashing and to give instructions how to recover ( untrash ) the trashed file.

 

EXAMPLES

1) automated tidy up of a global trash using cron

In this example the cron entry of all participating systems is identical and the global trash is physically located in the directory /data_adm1/dat/trash. This is why the purge action is only executed if the directory exists on the system (important to check in a clustered environment where the global trash should resists on a cluster package, too).

1.1) trash.cfg configuration file

        #
        # trash.cfg - trash/untrash/cltrash configuration file
        #
        # [00] 15.02.2005 CWa   Initial Version
        #

        #
        # Fileformat:
        #
        #  OPTION=<VALUE>
        #


        # Trash basedir. This directory holds all trashed files. 
        #
        TRASHDIR=/dat/trash/files


        # Logdir. 
        #
        LOGDIR=/dat/trash/logs

1.2) needed cron entries to purge the global trash and remove the trash info files

        [ /data_adm1/dat ]
        [ root@adm_db1_prod ][ksh]: crontab -l 

        :
        #
        # purge trash (see also: cltrash -a remove)
        #
        0 2 * * * [ -d /data_adm1/dat/trash ] && /opt/edrc/bin/cltrash \
          -a purge -d 14 > /dev/null 2>&1
        :

        :
        #
        # remove trash info files (see also: cltrash -a purge)
        #
        0 2 * * * [ -x /opt/edrc/bin/cltrash ] && /opt/edrc/bin/cltrash \
          -a remove -r / -d 14 > /dev/null 2>&1
        :

 

SEE ALSO

edrcintro(1), trash(1), trash.cfg(4), untrash(1)

 

NOTES

cltrash travels thru all filesystems if the rootdir is specified as / ( -r / ), therefore if NFS mounted filesystems are used, those filesystems are searched multiple times.

 

BUGS

-

 

AUTHOR

cltrash was developed by Christian Walther. Send suggestions and bug reports to wa2l@users.sourceforge.net .

 

COPYRIGHT

Copyright © 2008 Christian Walther

This is free software; see edrc/doc/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


 

Index

NAME
SYNOPSIS
AVAILABILITY
DESCRIPTION
OPTIONS
EXIT STATUS
FILES
EXAMPLES
SEE ALSO
NOTES
BUGS
AUTHOR
COPYRIGHT

This document was created by man2html using the manual pages.
Time: 00:13:56 GMT, March 08, 2025